Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Libum not correctly installed/located on windows 10 pro? #21

Closed
natecermak opened this issue Jun 27, 2024 · 2 comments
Closed

Libum not correctly installed/located on windows 10 pro? #21

natecermak opened this issue Jun 27, 2024 · 2 comments

Comments

@natecermak
Copy link

natecermak commented Jun 27, 2024

I am unable to run the test module or run UMP.get_ump(). Both present the error below:

PS C:\> python3 -m sensapex.test
Traceback (most recent call last):
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\ctypes\__init__.py", line 450, in __getattr__
    dll = self._dlltype(name)
          ^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.1264.0_x64__qbz5n2kfra8p0\Lib\ctypes\__init__.py", line 379, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: Could not find module 'libum' (or one of its dependencies). Try using the full path with constructor syntax.

libum.dll is present in Python312/site-packages/sensapex/, as is umpcli.exe. I am on python3.12, and have tried both local installs (pip install -e <local-path-to-cloned-repo>) and install from pypi (pip3 install sensapex). I am running Python 3.12.4, pip 24.1.1, sensapex-py==1.400.0.

Any advice would be greatly appreciated. Thanks!

@jhuhtamaki
Copy link

sensapex.py attempts to load libum.dll from multiple locations sequentially; error handling of one of the steps does not work correctly: The ctypes.windll.libum raises AttributeError instead of expected OSError.

with contextlib.suppress(OSError):
  return ctypes.windll.libum

The behaviour was changed in recent Python release
One possible workaround, that should work on old and new Python versions:

with contextlib.suppress(OSError, AttributeError):
  return ctypes.windll.libum

@outofculture
Copy link
Collaborator

Thanks for figuring this out, @jhuhtamaki! Fix is released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants