AlexShkarin / pyLabLib

Python package for device control and experiment automation
http://pylablib.readthedocs.io
GNU General Public License v3.0
125 stars 28 forks source link

ThorlabsBackendError: backend exception: 'read returned less data than expected' ('read returned less data than expected') #81

Open Atharvhardikar43 opened 3 months ago

Atharvhardikar43 commented 3 months ago

Hi, I am new to this. I tried to follow the docs. But getting this error when i run this code : from pylablib.devices import Thorlabs stage = Thorlabs.KinesisMotor("74000948") stage.get_position() Error: ThorlabsBackendError: backend exception: 'read returned less data than expected' ('read returned less data than expected') There is a solution mentioned in the docs: "is_rack_system=True". But i am still getting this error. Can someone please help? And give more detailed instructions? Thanks, Atharv

AlexShkarin commented 3 months ago

Dear Atharv,

Can you specify which device is that? Regarding setting the rack system: I know that at least some devices will completely freeze if you try to communicate with them using the wrong is_rack_system parameters. Therefore, I would suggest completely power cycle the device between the attempts, ideally by disconnecting the power supply, since the on/off button on some of the devices such as K-cubes is software-controller and won't do anything when the device is frozen.

Hence, I would do something like power cycling the device, then running this code:

from pylablib.devices import Thorlabs
with Thorlabs.KinesisMotor("74000948",is_rack_system=False) as stage:
    print(stage.get_device_info())

then power cycling the device again, and running

from pylablib.devices import Thorlabs
with Thorlabs.KinesisMotor("74000948",is_rack_system=True) as stage:
    print(stage.get_device_info())

Make sure that no other software using the device (such as Thorlabs Kinesis) is running at the same.

Sincerely,

Alexey.