Open aidenleefb opened 3 years ago
I am getting this same effect about 5 out of 10 attempts to import. I have no information to add.
I am also using a venv and getting this error
I was eventually forced to use a child process created from my main script, which takes a position argument and attempts to import the DLL and move the motor to that position. I use it in a retry loop in case it crashes which sometimes happen.
Hello, I am trying to interface Thorlabs apt motion controller using a python script.
I am looking at the instruction on your github page GitHub - qpit/thorlabs_apt: python module for Thorlabs' APT library
In step #3 of the installation instruction, you mention that I should copy APT.dll from APT installation path\APT Server directory to Windows\System32 location.
I tried this option but when I try:
Import thorlabs_apt as apt
My program will crash without giving me any errors.
If I remove the APT.dll from Windows\System32 location, it generates the following errors:
File "C:\Users\aidenlee1\AppData\Roaming\Python\Python37\site-packages\shiboken2\files.dir\shibokensupport__feature.py", line 142, in _import return original_import(name, *args, kwargs) File "C:\Users\aidenlee1**hidden**\", line 5, in
import thorlabs_apt as apt
File "C:\Users\aidenlee1\AppData\Roaming\Python\Python37\site-packages\shiboken2\files.dir\shibokensupport__feature__.py", line 142, in _import
return original_import(name, *args, kwargs)
File "C:\Users\aidenlee1\Anaconda3\envs**hidden**\lib\site-packages\thorlabs_apt__init.py", line 1, in
from .core import
File "C:\Users\aidenlee1\AppData\Roaming\Python\Python37\site-packages\shiboken2\files.dir\shibokensupport__feature__.py", line 142, in _import
return original_import(name, args, kwargs)
File "C:\Users\aidenlee1\Anaconda3\envs**hidden\lib\site-packages\thorlabs_apt\core.py", line 1376, in
_lib = _load_library()
File "C:\Users\aidenlee1\Anaconda3\envs\ hidden\lib\site-packages\thorlabs_apt\core.py", line 1360, in _load_library
lib = ctypes.windll.LoadLibrary(filename)
File "C:\Users\aidenlee1\Anaconda3\envs\hidden****\lib\ctypes\ init__.py", line 442, in LoadLibrary
return self._dlltype(name)
File "C:\Users\aidenlee1\Anaconda3\envs**hidden**\lib\ctypes\init.py", line 364, in init__
self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found
Based on my testing, the error is generated from import thorlabs_apt as apt.
Some other setting I am using are:
Some other observations:
If possible, could you help me solve this issue?
Kind regards,
-Aiden