I followed the instructions here...
https://github.com/ahupp/python-magic#dependencies
I ran pip install python-magic and it installed without any issues. Then I installed cygwin and added C:\cygwin\bin to my system path. When I run the python interpreter in a Windows command prompt and import magic I get this error...
Python 2.7.3 (default, Apr 10 2012, 23:31:26) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.
>>> import magic
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Python27\lib\site-packages\magic.py", line 161, in <module>
raise ImportError('failed to find libmagic. Check your installation')
ImportError: failed to find libmagic. Check your installation
>>>
Did I miss a step?
The
python-magicuselibmagic,The
libmagicneedsmagic1.dll,That
magic1.dllis in the file package ofgnuwin32.Solution 1:
Download
binaries ziporsetuppackage of file, and adding path ofbindirectory of it toPATHenvironment variable.Solution 2:
Also there is a new change-set in code of
python-magicthat fixed the problem and you don't need to file package ofgnuwin32(just addbindirectory ofcygwintoPATH), but currently there is not yet inmagic.pywhile you install it withpip install python-magicor bypip install python-magic --upgrade,So you need to install
python-magicfrom master.