MSLNZ / msl-equipment

Manage and communicate with equipment in the laboratory
MIT License
15 stars 13 forks source link

AVANTES: function 'AVS_ActivateConn' not found #9

Closed Saldenisov closed 9 months ago

Saldenisov commented 9 months ago

When using version 0.2.0 the code gives this error function 'AVS_ActivateConn' not found, python version = 3.9.18. When running with version 0.1.0 the codes executes with python version = 3.8.12. Once I updated version 0.1.0 to 0.2.0 and then went back to 0.1.0 with python 3.8, nothing works:( Can you please solve this issue?

jborbely commented 9 months ago

I think the issue is that you also changed the version of the AvaSpec DLL that you are using. Did you change the DLL?

The version of the DLL that was used to write the Python wrapper code was AvaSpec version 9.7.0.0 (January 2018). The Avantes software developers probably removed the AVS_ActivateConn function from the version of the DLL that you are now using.

If you use an older DLL that may solve this issue.

Alternatively, if you want to use the newer DLL, you need to comment out (or delete) lines 610 and 611 in your ..\site-packages\msl\equipment\resources\avantes\avaspec.py file. That should fix your specific error; however, more errors may occur because the DLL is different and more DLL functions may have been removed or the DLL function signatures may have been modified.

Please let me know which 'AVS_*' functions you needed to comment out (delete) in your avaspec.py file to no longer get an AttributeError: function 'AVS_*' not found when you connect to your device. I can then see if these missing DLL functions would cause an issue in the wrapper code and update the wrapper code accordingly. If you are able to share the DLL you are using, that would be helpful.

Saldenisov commented 9 months ago

Hi @jborbely

I commented these lines in avaspec.py

'AVS_Heartbeat'
'AVS_GetOemParameter'
'AVS_SetOemParameter'
'AVS_ActivateConnCb'

AVANTES does not respond on email. Seems to be, that I need to call them.

here is the link to DLL.

jborbely commented 9 months ago

The version of your DLL is 9.4.0.1 (older than 9.7.0.0), which means that those functions were not yet written.

I have pushed a fix for this issue.