Skip to content

Termination of Python when not able to find video device #13

@ebaumer

Description

@ebaumer

Dear Gerbart,

Thank you for the awesome python wrapper for v4l2!!!

I running into an issue when v4l2capture can not find a device at the specified path. I have a try/catch statement surrounding the opening of the video device in case the user specifies an incorrect path:

import v4l2capture as vc
try:
    self.cam = vc.Video_device(self.cnfg['devLoc'])       
except:
    ...

As one might expect, for an incorrect path an IOError is returned:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 2] No such file or directory: '/dev/video5/'

However, unexpectedly, python is immediately terminated as well, whether it be a program or python interactive shell. Is there a way to handle this such that the python shell or program is not immediately terminated?

Thanks!!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions