ImSwitch icon indicating copy to clipboard operation
ImSwitch copied to clipboard

Then disconnecting the pvcam camera, the program fails to close the camera.

Open dboonz opened this issue 1 year ago • 1 comments

Bug description When I connect a pvcam camera and close imswitch, a runtimeerror is raised as the camera cannot be closed. The camera works fine the next time, so it seems that the camera is closed twice.

How to reproduce Steps to reproduce the behavior:

  1. Connect a pvcam camera
  2. Start imswitch
  3. Close imswitch
  4. Look at the console, you'll see:


ERROR:imswitch:[launchApp] Traceback (most recent call last):
  File "C:\Users\dirk\mambaforge\envs\imswitch\lib\site-packages\pyvcam-2.1.5-py3.9-win-amd64.egg\pyvcam\camera.py", line 258, in close
    pvc.close_camera(self.__handle)
RuntimeError: This is not the handle of an open device (PL_ERR_DEVICE_HANDLE_INVALID)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\dirk\PycharmProjects\imswitch_hackathon\ImSwitch_xavier\imswitch\imcommon\applaunch.py", line 49, in launchApp
    controller.closeEvent()
  File "C:\Users\dirk\PycharmProjects\imswitch_hackathon\ImSwitch_xavier\imswitch\imcontrol\controller\ImConMainController.py", line 148, in closeEvent
    self.__masterController.closeEvent()
  File "C:\Users\dirk\PycharmProjects\imswitch_hackathon\ImSwitch_xavier\imswitch\imcontrol\controller\MasterController.py", line 91, in closeEvent
    attr.finalize()
  File "C:\Users\dirk\PycharmProjects\imswitch_hackathon\ImSwitch_xavier\imswitch\imcontrol\model\managers\MultiManager.py", line 63, in finalize
    subManager.finalize()
  File "C:\Users\dirk\PycharmProjects\imswitch_hackathon\ImSwitch_xavier\imswitch\imcontrol\model\managers\detectors\PhotometricsManager.py", line 219, in finalize
    self._camera.close()
  File "C:\Users\dirk\mambaforge\envs\imswitch\lib\site-packages\pyvcam-2.1.5-py3.9-win-amd64.egg\pyvcam\camera.py", line 262, in close
    raise RuntimeError('Failed to close camera.')
RuntimeError: Failed to close camera.

Expected behavior Imswitch should not complain about closing the camera. @mcfaddendavid do you have this behaviour as well?

Screenshots If applicable, add screenshots to help explain your problem.

Environment

  • OS: "Windows 10"
  • ImSwitch version: Latest development version
  • How you downloaded ImSwitch: git

Additional context Add any other context about the problem here, if applicable.

dboonz avatar Apr 27 '23 15:04 dboonz

@dboonz did you ever manage to fix this bug at some point?

jacopoabramo avatar Jun 16 '23 11:06 jacopoabramo