Lorenzo Bottaccioli
Lorenzo Bottaccioli

Reputation: 441

python-magic WindowsError: [Error 193] %1 is not a valid Win32 application

Hi I'm trying to use python-magic on windows 8 but when I try to import with the command import magic it gives me this error WindowsError: [Error 193] %1 is not a valid Win32 application I have tried both with 64-bit and 32-bit version of Python 2.7.10 but I always get this error.

Thx

Upvotes: 2

Views: 2008

Answers (3)

matebende
matebende

Reputation: 609

The only solution for me was installing Microsoft Visual C++ Build Tools (from here). But it's a quite heavy dependency for magic to work under python 2.7.

Upvotes: 0

João Godinho
João Godinho

Reputation: 191

I solve this issue installing the library "python-magic-bin" using the command pip install python-magic-bin

Upvotes: 1

Olivier Pons
Olivier Pons

Reputation: 15778

Found it here: https://github.com/ahupp/python-magic/issues/24k

Resolved this by installing the 64-bit version of Cygwin (http://cygwin.com/install.html) and copying the following list of DLLs from \bin to C:\Windows\System32:

  • cygwin1.dll
  • cygz.dll
  • cygmagic-1.dll (Don't forget to rename it to magic1.dll)

Upvotes: 0

Related Questions