Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
OSError importing wand.image on Termux (missing glibc) #409
On Termux, I get the following traceback:
This makes sense as Termux does not provide glibc.
Wand version: 0.5.2
The offending code appears to be here:
Indeed, changing sys.platform to
We just need another
Sadly, I do not have the time / resources to develop against that platform. But the second options can be something like...
diff --git a/wand/api.py b/wand/api.py index 38e19bd..f955853 100644 --- a/wand/api.py +++ b/wand/api.py @@ -218,7 +218,14 @@ else: elif sys.platform.startswith(('dragonfly', 'freebsd')): libc = ctypes.cdll.LoadLibrary(ctypes.util.find_library('c')) else: - libc = ctypes.cdll.LoadLibrary('libc.so.6') + libc_paths = ('libc.so.6', 'libc.so', 'libc.a', + ctypes.util.find_library('c')) + for libc_path in libc_paths: + try: + libc = ctypes.cdll.LoadLibrary(libc_path) + break + except (IOError, OSError): + continue libc.fdopen.argtypes = [ctypes.c_int, ctypes.c_char_p] libc.fdopen.restype = ctypes.c_void_p libc.fflush.argtypes = [ctypes.c_void_p]
Let me know if the above suggested patch works, or if you know a way to identify bionic platform via standard Python modules.
I think that approach punts the problem down field, but suggests a few good points. I'll spend some time reworking the solution. Honestly, we only use