-
Notifications
You must be signed in to change notification settings - Fork 50
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
Windows 0x7e error cffi fails to load dll library #489
Comments
Hello @amrosado, You're right, I had the same error using I saw:
Then:
However this works:
The I'll add a note to the README, thank you for alerting me to this problem. |
Thinking again, before making a recommendation, it would be good to find out why the |
I was trying to figure that out myself, because I would prefer the safer way of loading the dll. Some things I notice when looking at the code were that cffi's ffi.dlopen is given 'libvips-42.dll' which I believe works when the path is configured, but could get an absolute path to the dll. I also noticed in cffi's _load_backend_lib that ctypes.util.find_library is given the dll file name as the name variable, but the documentation reads that it should be a name of the binary without an extension (dll, so). |
python version: 3.11.9
pyvips: 2.2.3
cffi: 1.16.0
libvips: 8.15.3
Pyvips fails to load dll library despite the following code:
cffi version installed by pip cannot load library using ffi.dlopen. Additionally, importing pyvips attempts to use cffi to load library, but this fails regardless of dll version with and without using ffi/static dll. This fails even when using cffi outside of the scope of pyvips. Upgrading cffi to 1.17.0rc1 seems to enable using dlopen to open the library. Despite being able to use cffi to independently load the library import pyvips still fails when attempting to load_library with a path that is not absolute. The following code enables importing pyvips in my environment.
In python 3.11, I decided to use the following code to successfully import pyvips:
I am able to find the library and load the library independently with ctypes. This seems to also not work with libvips 8.13 which is described in the current documentation.
It would be beneficial I think to suggest to windows users it is okay to not dynamically add the dll directory at runtime despite this being the preferred way to do load dlls using the winapi.
The text was updated successfully, but these errors were encountered: