Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError when initializing Thorlabs TSI camera since version 1.4.2 #65

Open
rgeneaux opened this issue Nov 15, 2023 · 1 comment
Open

Comments

@rgeneaux
Copy link

Hi,

Since the upgrade to version 1.4.2, we encounter the following issue on a Thorlabs Zelux Monochrome sCMOS camera:
Things are fine in 1.4.1.

Minimal code to reproduce bug

from pylablib.devices import Thorlabs

serialnumbers = Thorlabs.list_cameras_tlcam()

cam = Thorlabs.ThorlabsTLCamera(serialnumbers[0])

Error message (python==3.9.0, pylablib==1.4.2, windows 10)

Traceback (most recent call last):
  File "C:\Users\ATTOExpFa1b\PycharmProjects\pymodaq_plugins_thorlabs\test_pylablib.py", line 6, in <module>
    with Thorlabs.ThorlabsTLCamera(sn) as cam:
  File "C:\Miniconda3\envs\v410\lib\site-packages\pylablib\devices\Thorlabs\TLCamera.py", line 74, in __init__
    self.open()
  File "C:\Miniconda3\envs\v410\lib\site-packages\pylablib\devices\Thorlabs\TLCamera.py", line 110, in open
    self.set_color_format()
  File "C:\Miniconda3\envs\v410\lib\site-packages\pylablib\core\devio\interface.py", line 666, in wrapped
    res=func(**all_args)
  File "C:\Miniconda3\envs\v410\lib\site-packages\pylablib\devices\Thorlabs\TLCamera.py", line 205, in set_color_format
    cinfo=self.get_color_info()
  File "C:\Miniconda3\envs\v410\lib\site-packages\pylablib\core\devio\interface.py", line 667, in wrapped
    return parse_reply(res,args,kwargs)
  File "C:\Miniconda3\envs\v410\lib\site-packages\pylablib\core\devio\interface.py", line 654, in parse_reply
    if len(returns)!=len(res):
TypeError: object of type 'NoneType' has no len()

Unrelated PS: thanks for the great work - we use pylablib everyday in our labs!

@AlexShkarin
Copy link
Owner

Hello!

Thank you for the kind words!
You are right, this is a bug intrduced when adding the color mode, which breaks the code on monochrome cameras. I'm not quite sure how it made through the testing...
To fix it for now, you'll need to replace the file pylablib/devices/Thorlabs/TLCamera.py with the fixed version. Otherwise, this will be fixed in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants