Skip to content

import errors for thorlabs apt motion controller #33

@aidenleefb

Description

@aidenleefb

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:

  1. anaconda virtual environment
  2. Python version 3.7.8

Some other observations:

  1. If I add APT.dll from APT installation path\APT Server directory to Windows\System32 location and create a single threaded application, I can control the motor
  2. if I create a second thread or use it with pyqt, the program crashes without error

If possible, could you help me solve this issue?

Kind regards,

-Aiden

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions