Module python-magic on/for Windows?
Larry Hale
larzluv at hotmail.com
Mon May 12 00:42:55 EDT 2008
THANKS, AGAIN, for the reply! :)
Okay, now I -really- feel silly... :>
So, when I was going to try what you'd suggested, I noticed something
peculiar: I hadn't "changed" anything on my system, but now, when I
tried to "import magic" I got a missing DLL error. For a DIFFERENT
DLL! This got me to thinking...
Turns out, when I was having "success" earlier, I was -in- the C:
\Program Files\GnuWin32\bin directory (where file.exe and related .dll
files are).
So I added C:\Program Files\GnuWin32\bin to the (system/Windows)
PATH. Everything worked. I removed all the copious copies of the
DLL, the magic files, etc., littering my hard drive in every other
location. Still worked.
'Course, I don't honestly know why it didn't work with the files
copied to other locales contained in the sys/Py paths... perhaps it
was, as you mentioned, wanting the tree-structure to be the same? (I
haven't the heart to check this out fully right now... *maybe* at a
later time... ;) )
Yeah, I know. But HONESTLY! I could have -sworn- I'd already tried
THAT... you know, all the "obvious"/"I've been programming/working in
computers (albeit 'Windows' until lately) for ~25 years; yeah, I'm a
'hacker'..." stuff. I -swear-!
[EGG ON FACE]
[SIGH] Well, I'd say "live and learn", but I'm still scratching my
head. But, 'nough of that. Thanks for your replies, Michael, and I'm
off to work _with_ the module now, then work-up my HowTo (and
experiment with making an "egg"?? ;) )...
Caio!
-Larry :P :)
On May 11, 11:09 pm, Michael Torrie <torr... at gmail.com> wrote:
> Larry Hale wrote:
> > ALSO: I've even tried putting the 4 "magic" files INTO the .egg
> > file... still no-go. :/
>
> It's often the custom of programs ported from unix to windows to use the
> dll location as a key to find the other files that are typically in
> share, or etc. GTK, for example uses ../share and ../etc from the
> location where the dlls are stored (if the dlls are in a folder called bin).
>
> In this case I'd try making a folder in the Python25 folder called
> "share" and put the contents of the gnuwin32 share/file stuff in there.
> Should look something like this:
>
> c:/python25/share/file/magic.mime.mgc
> c:/python25/share/file/magic
> c:/python25/share/file/magic.mgc
> c:/python25/share/file/magic.mime
>
> Or, judging by a string I found in the dll itself, you might have to put
> the files here:
>
> c:/progra~1/File/share/file/magic
>
> Although if such a path really is hardcoded into the dll, this is
> certainly a bug, since it will fail on certain non-english windows systems.
>
> Anyway, who knows. Give these options a try.
More information about the Python-list
mailing list