Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
libmagic library issue
#1
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?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Issue with a library ebolisa 2 1,713 Feb-27-2021, 08:35 AM
Last Post: ebolisa
  Pymssql library failing when upgrading to Python 3.7 - win32 issue stixmagiggins 5 7,351 Jun-24-2019, 06:46 AM
Last Post: snippsat
  Issue python3.6 while inheriting telnet library sourabhjaiswal92 4 4,030 May-09-2018, 05:20 AM
Last Post: sourabhjaiswal92
  PyInstaller, how to create library folder instead of library.zip file ? harun2525 2 4,745 May-06-2017, 11:29 AM
Last Post: harun2525

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020