When trying to load a .dll file with
os.add_dll_directory("C:\\path\\to\\file")
library = ctypes.windll.LoadLibrary("C:\\path\\to\\file\\tdcbase.dll")
I get following error message:
FileNotFoundError: Could not find module 'C:\path\to\file\tdcbase.dll' (or one of its dependencies).
Try using the full path with constructor syntax.
I'm trying to run it with Python 3.9.7 on Windows11 (on Windows10 it also didn't work). Using other Python versions (3.6, 3.7 and 3.8) did not change anything either. Also, I don't think that there are any dependencies whose directory would need to be added.
There is also a 32-bit version of that file (tdbase.dll). When I try to load this with my 64-bit machine, I get following error message:
OSError: [WinError 193] %1 is not a valid Win32 application
So it seems as if it can recognise that it is the wrong bit number, i.e. it can find the file, but in the case of 64-bits not?
Can anyone see where the problem lies?
EDIT: After installing an additional usb driver, which was needed to speak to the connected instrument, the library could be loaded and everything works fine now.