Python Forum

Full Version: libmagic library issue
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
have installed python 2.7.15 (32 bit) on windows 2012 R2 -64 bit server. we have installed elastalert which install magic & liblogic modules. when I run the elastalert process , its giving following error.

Error:
import magic File "D:\Python27\Lib\site-packages\magic.py", line 181, in <module> raise ImportError('failed to find libmagic. Check your installation') ImportError: failed to find libmagic. Check your installation
got something in google and copied files from https://github.com/pidydx/libmagicwin64 and placed into c:\windows\system32 folder. still getting same error.

the mail problem I see is python is not finding the copied dlls
>>> os.path.exists("C:\\Windows\\syswow64\\magic1.dll")
False
if I copy these files to C:\windows\syswow64 folder, python is able to find the file from system32.

>>> os.path.exists("C:\\Windows\\syswow64\\magic1.dll")
True
>>> ctypes.util.find_library('magic1')
'C:\\Windows\\system32\\magic1.dll'
when I run the import magic, its giving following error
>>> import magic
Error:
Traceback (most recent call last): File "<pyshell#63>", line 1, in <module> import magic File "D:\Python27\Lib\site-packages\magic.py", line 159, in <module> libmagic = ctypes.CDLL(dll) File "D:\Python27\Lib\ctypes\__init__.py", line 366, in __init__ self._handle = _dlopen(self._name, mode) WindowsError: [Error 193] %1 is not a valid Win32 application
Can anyone please suggest?