alliedvision / VimbaPython

Old Allied Vision Vimba Python API. The successor to this API is VmbPy
BSD 2-Clause "Simplified" License
93 stars 40 forks source link

Any way for checking if the camera is open or shut? #164

Open momarms opened 1 year ago

momarms commented 1 year ago

Hi,

I am a bit new and have been using the API with a multi-camera GUI. The cameras are in both 'SingleFrame' and 'Continuous' mode usage depending upon the requirement. Suppose for xyz reasons my GUI crashes and I am not able to shut the cameras properly. (I am not sure whether the cameras close properly if the GUI crashes.) When I restart the GUI, I get the following error while opening the cameras.

        raise VimbaException(error)
pymba.vimba_exception.VimbaException: Operation is invalid with the current access mode.

I have to unplug and replug the cameras or restart my system to make them work again. I want to test whether this is being caused by the cameras not closing properly or because of some other reason.

I cannot simply use a .close() command before opening them as it would also lead to an error if the cameras are not already open.

Is there any way I can check whether the cameras are open or shut before I actually run the .open() command? I have tried a few conditions but all of them seem to rely on the camera being already open or shut. If you think this could be happening because of something else, I would appreciate any advice on that too.

Thanks!

Teresa-AlliedVision commented 1 year ago

Pymba is not the official Vimba Python API, so we can't tell if the camera is being closed properly or why not. The error message does imply, that the camera was not closed correctly.

There is a Github for Pymba that you can contact with issues, otherwise I would recommend to switch to Vimby Python (installed together with the Vimba SDK). Pymba Github