|
Impact Acquire SDK Python
|
When using the Impact Acquire Python SDK, importing the Python module with a statement like:
fails with an error message similar to:
ImportError: Failed to import test module: test_mvIMPACT_Acquire
Traceback (most recent call last):
File "C:\Python311\Lib\unittest\loader.py", line 407, in _find_test_path
module = self._get_module_from_name(name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Python311\Lib\unittest\loader.py", line 350, in _get_module_from_name
__import__(name)
File "C:\Users\user\my_python_app.py", line 13, in <module>
from mvIMPACT import acquire
File "C:\Python311\Lib\site-packages\mvimpact-2.50.0-py3.11-win-amd64.egg\mvIMPACT\__init__.py", line 1, in <module>
from .acquire import *
File "C:\Python311\Lib\site-packages\mvimpact-2.50.0-py3.11-win-amd64.egg\mvIMPACT\acquire.py", line 13, in <module>
from . import lib_mvIMPACT_acquire
ImportError: DLL load failed while importing lib_mvIMPACT_acquire: The specified module could not be found.
This problem is caused by an unusual Impact Acquire installation path (or a missing installation). It should not occur if Impact Acquire is installed normally and the necessary libraries are installed to the %windir%/System32 directory. (or %windir%/SysWOW64 when running 32-bit applications on a 64-bit Windows® system).
By using os.add_dll_directory, it is possible to specify additional search paths for Python to use during DLL resolution. Adding the directory in which the libraries mvDeviceManager.dll, mvImageProcessing.dll, mvPropHandling.dll, etc. reside should be enough to resolve the issue.
Note that the call to os.add_dll_directory must occur before the Impact Acquire module is imported.