OS: Windows 11 build 26100.3476
Python versions: 3.12.9 and 3.8.10
Issue:
I am getting an error when importing this library into python. I am able to build and install without any issues. I have placed the APT.dll file into C:\Windows\system32. When I load python and attempt to import the library, I get the following error:

Since I have the file in the correct location and ctypes.util.find_library("APT") is able to find the path to the library, I know it can at least find the system.
What I've done to attempt to solve:
**Fix Winmode on dll load function: ** According to this stackOverflow post, setting the winmode to 0 can sometimes solve the issue. I also tried the os.add_dll_directory method, but it appeared to have no effect. I was able to successfully import the dll by choosing the ctypes CDLL loader instead of the default windll.LoadLibrary and setting winmode=1
i.e. (L1357) lib = ctypes.windll.LoadLibrary(filename) -> lib = ctypes.CDLL(filename, winmode=1)
After successfully loading the library, I ran into another issue in the _APTAPI.py file. It appears that the imported dll does not contain one of the methods imported, MOT_SetMotorParams. I commented the lines referencing those methods just to see if I could get it to load.
Finally, I tried to import the library once more only to have it crash when running APTInit(). It completely exits out of the python terminal when this function is run. I can tell that the imported dll has the APTInit() method since running print(lib.dict) shows that it is imported. I'm not sure what to do from here because I cannot see inside the init function to determine what is wrong.
**Downgrade Python to 3.8.10: ** No effect, same issue.
Any thoughts? Looks like they may have changed the way the APT.dll is formatted. When I downloaded the program from ThorLabs, I noticed that the only APT.dll was named Thorlabs.APT.dll. To make this compatible, I just deleted the "Thorlabs." to try to get this library working. Don't know if that's an issue or not.
OS: Windows 11 build 26100.3476
Python versions: 3.12.9 and 3.8.10
Issue:
I am getting an error when importing this library into python. I am able to build and install without any issues. I have placed the APT.dll file into C:\Windows\system32. When I load python and attempt to import the library, I get the following error:
Since I have the file in the correct location and ctypes.util.find_library("APT") is able to find the path to the library, I know it can at least find the system.
What I've done to attempt to solve:
**Fix Winmode on dll load function: ** According to this stackOverflow post, setting the winmode to 0 can sometimes solve the issue. I also tried the os.add_dll_directory method, but it appeared to have no effect. I was able to successfully import the dll by choosing the ctypes CDLL loader instead of the default windll.LoadLibrary and setting winmode=1
i.e. (L1357) lib = ctypes.windll.LoadLibrary(filename) -> lib = ctypes.CDLL(filename, winmode=1)
After successfully loading the library, I ran into another issue in the _APTAPI.py file. It appears that the imported dll does not contain one of the methods imported, MOT_SetMotorParams. I commented the lines referencing those methods just to see if I could get it to load.
Finally, I tried to import the library once more only to have it crash when running APTInit(). It completely exits out of the python terminal when this function is run. I can tell that the imported dll has the APTInit() method since running print(lib.dict) shows that it is imported. I'm not sure what to do from here because I cannot see inside the init function to determine what is wrong.
**Downgrade Python to 3.8.10: ** No effect, same issue.
Any thoughts? Looks like they may have changed the way the APT.dll is formatted. When I downloaded the program from ThorLabs, I noticed that the only APT.dll was named Thorlabs.APT.dll. To make this compatible, I just deleted the "Thorlabs." to try to get this library working. Don't know if that's an issue or not.