

Minor version bumps should be backwards compatible. See COMPAT.md for a guide to libmagic / python-magic compatibility. To work around this, python-magic includes a compatibility layer for the libmagic API. The python bindings shipped with libmagic use a module name that conflicts with this package. To run against a specific python version: LC_ALL=en_US.UTF-8 python3 test/test.py To run tests locally across all available python versions. To run the tests across a variety of linux distributions (depends on Docker). Sure where the bug lies feel free to file an issue on GitHub and I can

Historically, most bugs that have been reported against python-magicĪre actually bugs in libmagic libmagic bugs can be reported on their Python-magic is a thin layer over the libmagic C library. Make sure your libmagic and python builds are consistent. 'WindowsError: exception: access violation writing 0x00000000 ' This may indicate you are mixing Here are 64-bit builds of libmagic for windows.

'WindowsError: %1 is not a valid Win32 application':Īttempting to run the 32-bit libmagic DLL in a 64-bit build of Try specifying the path to the file explicitly in theĬonstructor: magic.Magic(magic_file="path_to_magic_file"). Installations of libmagic do not correctly point to their magicĭatabase file. 'MagicException: could not find any magic files!': some

from_file ( "testdata/test.pdf" ) 'PDF document, version 1.2' # recommend using at least the first 2048 bytes, as less can produce incorrect identification > magic. Thisįunctionality is exposed to the command line by the Unix commandįile. Their headers according to a predefined list of file types. libmagic identifies file types by checking Python-magic is a Python interface to the libmagic file type
