You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Environment: Windows 7, Python 2.7, Most recent Cygwin x86 (DLL 2.2.1-1)
OK. So I got python-magic running only after moving the Cygwin PATH to the beginning of the %PATH% env.var. :
1. Install the cygwin-libmagic in Cygwin
2. Install https://github.com/ahupp/python-magic (python setup.py install)
3. Place c:\cygwin\bin\ right at the beginning of PATH env.var.
4. Open python, import magic
Without the step 3 I got:
>>> import magic
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\magic.py", line 184, in <module>
raise ImportError('failed to find libmagic. Check your installation')
ImportError: failed to find libmagic. Check your installation
It looks like the find_library() method can’t be bothered to look for the libs in other places from the %PATH%. The dll it finds is in a Webex folder...
Once I've put c:\cygwin\bin at the beginning of %PATH%, all my life problems were immediately solved :
So I wanted to check if it really was causing the problem, moved the path to Cygwin back to the end of %PATH%, rerun cmd and opened python console, and guess what ? It still works ! Why ? :
Hah, I have no idea. The dll load path stuff is mysterious (i don't actually own a windows machine). If you find a good solution please submit it and I'll add to the docs.
Does it find the lib if you put that path in /etc/ld.so.conf and re-run ldconfig? I don't understand your proposal. Libraries should not be handling command line args.
What is "link time" in this context though? In python we don't really have that distinction. I'm tempted to just define an env variable that people can defined to override the location then I can get rid of all the janky platform-specific paths. Would be a breaking change though.
Activity
ahupp commentedon Sep 12, 2015
Hah, I have no idea. The dll load path stuff is mysterious (i don't actually own a windows machine). If you find a good solution please submit it and I'll add to the docs.
ahupp commentedon Sep 12, 2015
Or rather, find an answer. It's hard to imagine that the position in the path really effects this.
ahupp commentedon Apr 26, 2016
Does it find the lib if you put that path in /etc/ld.so.conf and re-run ldconfig? I don't understand your proposal. Libraries should not be handling command line args.
ahupp commentedon Apr 26, 2016
What is "link time" in this context though? In python we don't really have that distinction. I'm tempted to just define an env variable that people can defined to override the location then I can get rid of all the janky platform-specific paths. Would be a breaking change though.
ahupp commentedon Aug 25, 2023
Merging into #293