file/python
2022-09-01 12:19:49 +00:00
..
file_magic Fix changelog, bump version to release to pypi 2018-06-01 18:17:57 +00:00
.cvsignore PR/354: Fix stray ^M's 2014-05-14 23:32:30 +00:00
CHANGELOG.md PR/285: Benjamin: python detect functions don't work in a multi-threaded 2021-09-09 17:48:54 +00:00
example.py New pure-Python bindings (same API as before, with missing methods added). 2011-01-14 22:33:07 +00:00
HOWTO list of commands to update the module 2022-09-01 12:19:49 +00:00
LICENSE Fix changelog, bump version to release to pypi 2018-06-01 18:17:57 +00:00
magic.py fix python tests, better cleanup 2022-09-01 10:27:21 +00:00
magic.pyi Better error checking and pyi file addition from (Hoel Bezier) 2022-07-24 23:55:19 +00:00
Makefile.am Add more files to the tar distribution (Christoph Biedl) 2021-08-26 10:41:17 +00:00
pyproject.toml Add more info 2022-09-01 12:14:20 +00:00
README.md PR/477: add pip install. 2016-02-02 19:07:29 +00:00
setup.py Fix changelog, bump version to release to pypi 2018-06-01 18:17:57 +00:00
tests.py fix python tests, better cleanup 2022-09-01 10:27:21 +00:00
threads.py Add threads test from PR/285 2021-09-09 17:50:58 +00:00

file-magic: Python Bindings

This library is a Python ctypes interface to libmagic.

Installing

You can install file-magic either with:

python setup.py install
# or
easy_install .
# or
pip install file-magic

Using

import magic

detected = magic.detect_from_filename('magic.py')
print 'Detected MIME type: {}'.format(detected.mime_type)
print 'Detected encoding: {}'.format(detected.encoding)
print 'Detected file type name: {}'.format(detected.name)

Developing/Contributing

To run the tests:

python setup.py test