mabuchilab / Instrumental

Python-based instrumentation library from the Mabuchi Lab.
http://instrumental-lib.readthedocs.org/
GNU General Public License v3.0
120 stars 80 forks source link

Thorlabs CCS spectrometer reopen retrives invalid Object #149

Open mdopy opened 2 years ago

mdopy commented 2 years ago

Hello,

I'm not sure if this issue is somehow related to the last one but I have still problems with the Thorlabs CCS spectrometer. The first time I run the programm everything is working proper. After I finished the program I close the spectrometer with dev_spec.close(). When reopening the spectrometer with dev_spec = thorlabs_ccs.CCS(paramsets[0], reopen_policy='reuse') everything seems to be fine but when trying to acces the spectrometer with an arbitrary command I always receive the same error.

dev_spec.close() Traceback (most recent call last):

File "C:\Users\dolm\AppData\Local\Temp/ipykernel_9812/1457110140.py", line 1, in dev_spec.close()

File "C:_Work\WPy64-38100\python-3.8.10.amd64\lib\site-packages\instrumental\drivers\spectrometers\thorlabs_ccs.py", line 190, in close self._NiceCCS.close()

File "C:_Work\WPy64-38100\python-3.8.10.amd64\lib\site-packages\nicelib\nicelib.py", line 701, in call return self._libfunc._call(args, kwds, niceobj=self._niceobj)

File "C:_Work\WPy64-38100\python-3.8.10.amd64\lib\site-packages\nicelib\nicelib.py", line 1171, in _call return self.sig.extract_outputs(c_args, retval, ret_handler_args)

File "C:_Work\WPy64-38100\python-3.8.10.amd64\lib\site-packages\nicelib\nicelib.py", line 219, in extract_outputs retval = self.ret_handler.handle(retval, ret_handler_kwargs)

File "C:_Work\WPy64-38100\python-3.8.10.amd64\lib\site-packages\nicelib\nicelib.py", line 543, in handle return self.func(retval, **kwargs)

File "C:_Work\WPy64-38100\python-3.8.10.amd64\lib\site-packages\instrumental\drivers\spectrometers\thorlabs_ccs.py", line 64, in ccs_errcheck raise ThorlabsCCSError(niceobj.error_message(error_code))

ThorlabsCCSError: b'Die angegebene Session oder Objektreferenz ist ung\xfcltig.'

To me it seems that the close() function is not working proper, as I'm not able to open the spectrometer with the reuse_policy='strict'. Furthermore it is not possible to open the invalid object through the variable explorer.

Greetings