Open SablyTv opened 2 years ago
+1 on this issue
https://stackoverflow.com/questions/59330863/cant-import-dll-module-in-python
Basically even though the file is there, on python 3.8+ the dll directory has to be declared.
I resolved this issue by following this:
Windows error message If you see an ugly ImportError when importing pylibdmtx on Windows you will most likely need the Visual C++ Redistributable Packages for Visual Studio 2013. Install vcredist_x64.exe if using 64-bit Python, vcredist_x86.exe if using 32-bit Python.
Im trying to import decode from pylibdmtx by:
from pylibdmtx.pylibdmtx import decode
but get this error:
Traceback (most recent call last): File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pylibdmtx\dmtx_library.py", line 38, in load libdmtx = cdll.LoadLibrary(fname) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\lib\ctypes__init__.py", line 451, in LoadLibrary return self._dlltype(name) File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\lib\ctypes__init.py", line 373, in init__ self._handle = _dlopen(self._name, mode) FileNotFoundError: Could not find module 'libdmtx-32.dll' (or one of its dependencies). Try using the full path with constructor syntax.
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "api.py", line 14, in
from pylibdmtx.pylibdmtx import decode
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pylibdmtx\pylibdmtx.py", line 10, in
from .wrapper import (
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pylibdmtx\wrapper.py", line 70, in
_dmtxVersion = libdmtx_function('dmtxVersion', c_char_p)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pylibdmtx\wrapper.py", line 58, in libdmtx_function
return prototype((fname, load_libdmtx()))
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pylibdmtx\wrapper.py", line 39, in load_libdmtx
LIBDMTX = dmtx_library.load()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pylibdmtx\dmtx_library.py", line 40, in load
libdmtx = cdll.LoadLibrary(
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\lib\ctypes__init__.py", line 451, in LoadLibrary
return self._dlltype(name)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\lib\ctypes__init.py", line 373, in init__
self._handle = _dlopen(self._name, mode)
FileNotFoundError: Could not find module 'C:\Users\Administrator\AppData\Local\Programs\Python\Python38-32\lib\site-packages\pylibdmtx\libdmtx-32.dll' (or one of its dependencies). Try using the full path with constructor syntax.