I've heard tell of a Python binding for libmagic (file(1) *nixy command; see http://darwinsys.com/file/). Generally, has anybody built this and worked with it under Windows?
The only thing I've been able to find is the python-magic module at http://hupp.org/adam/hg/python-magic/. [1] Is this "THE" python-magic module. (It seems to be to me, but obviously I don't know. :) [2] Has anybody been able to build THIS version under Windows? I've gotten as far as completing the "setup.py install" process. (After many troubles; I'll post the top-to-bottom HowTo-like info if/ when I ever get it to work. :) At this point, there -is- a "magic" module that can be imported (attempted-to, that is), but it fails. If I go to a cmd window, run the Py interpreter, and do "import magic" I get: [1] an error pop-up (Windows window, which is blocking [as opposed to "non-blocking", not "obscuring", though it does that, too] the cmd window): (X) This application has failed to start because magic1.dll was not found. Re-installing the application may fix this problem. [OK] [2] then, within the interpreter, I get: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "build\bdist.win32\egg\magic.py", line 2, in <module> File "build\bdist.win32\egg\cmagic.py", line 7, in <module> File "build\bdist.win32\egg\_cmagic.py", line 7, in <module> File "build\bdist.win32\egg\_cmagic.py", line 6, in __bootstrap__ ImportError: DLL load failed: The specified module could not be found. I'm using Python 2.5 on Windows XP Pro. I've got CYGWIN installed (more info can be provided if necessary) for a copy of file.exe (and libmagic.a @ 357KB and libmagic.dll.a @ 25KB in C:\cygwin\lib). I also have GNUWin32, also for file.exe alternatively (and libmagic.dll.a @ ~ 8KB in C:\Program Files\GnuWin32\lib). magic.py in C:\Program Files\Python25\Lib\site-packages\magic-0.1- py2.5-win32.egg imports cmagic.py (also in this egg), which imports _cmagic.py, which has the following: def __bootstrap__(): global __bootstrap__, __loader__, __file__ import sys, pkg_resources, imp __file__ = pkg_resources.resource_filename(__name__,'_cmagic.pyd') del __bootstrap__, __loader__ imp.load_dynamic(__name__,__file__) __bootstrap__() Now I *presume* my problem (at this point) is that I need to have libmagic named as "magic1.dll" -wherever- this module is looking for it. I'm just not sure, let alone if this is true, WHERE Python/ modules expect to find such things. Also, which version(s)/file(s) should be placed where, or...?? Thanks for any/all help/pointers. I apologize up-front if I left out any pertinent info; I'm paranoid about putting in too much (and some that may be worthless) already... :) Cheers, Larry Hale -- http://mail.python.org/mailman/listinfo/python-list