Closed mgehring999 closed 3 years ago
I don't have access to two spectrometers from Avantes, so this will be difficult for me to debug.
Since this error occurs only after you have killed the script with a CTRL+C
(a) does this Avantes error cause any issues in collecting/saving the data from a spectrometer or any other device you are using? or (b) is it an error that you prefer to not see before your script terminates? If (b) then you can try something like the following to suppress the error
try:
# your while loop code
except KeyboardInterrupt:
pass
try:
for device in devices:
device.deactivate()
device.disconnect()
except:
pass
What happens if you use two devices but only deactivate and disconnect from one of them?
I will assume that you have implemented a workaround for this issue, but I will provide one additional comment.
The disconnect method calls the AVS_Deactivate
and AVS_Done
functions in the DLL. AVS_Deactivate
requires the handle to a spectrometer as an input argument to close communication with that particular spectrometer (so calling device.deactivate()
in a loop makes sense) but AVS_Done
does not take any input arguments and, according to the manual, it "closes the communication and releases internal storage" so it should probably only be called once after the deactivate loop.
The following is an untested example
try:
# your while loop code
except KeyboardInterrupt:
for device in devices:
device.deactivate()
ava1.done() # could use ava1 or ava2 to call the done() method once
I am getting the following error when using function
disconnect()
from Avantes with two devices. The error occurs only when two devices are used. I'm using Python 3.8.1 with Sublime Text 3The following code raises this error: