I am newbie in python, and I am working on a project that need to detect the type of the file so I used magic library, However the code is not working and it is raising exception. The test code is:
import magic
magic.from_file("./example.db")
The Traceback :
Traceback (most recent call last):
- File "C:\Users\mariam\Desktop\pythonscripto\test.py", line 4, in <module>
magic.from_file("./example.db")
- File "C:\Users\mariam\Desktop\pythonscripto\magic.py", line 122, in from_file
m = _get_magic_type(mime)
- File "C:\Users\mariam\Desktop\pythonscripto\magic.py", line 111, in _get_magic_type
i = _instances[mime] = Magic(mime=mime)
- File "C:\Users\mariam\Desktop\pythonscripto\magic.py", line 60, in \__init__
magic_load(self.cookie, magic_file)
- File "C:\Users\mariam\Desktop\pythonscripto\magic.py", line 250, in magic_load
return _magic_load(cookie, coerce_filename(filename))
- File "C:\Users\mariam\Desktop\pythonscripto\magic.py", line 181, in errorcheck_negative_one
raise MagicException(err)
magic.MagicException: None
Any help?
I solved this problem, only make sure that your Python version is 64 bit, as well as dependencies files, you should include the following files in the same folder:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With