NetBSD/external/bsd/file/dist/python
christos ddb176824c merge conflicts between file-5.43 and file-5.45 2023-08-18 19:00:10 +00:00
..
file_magic Import file-5.43+; last was file-5.40 2022-09-24 20:07:53 +00:00
CHANGELOG.md Import file-5.43+; last was file-5.40 2022-09-24 20:07:53 +00:00
LICENSE
Makefile.am Import file-5.43+; last was file-5.40 2022-09-24 20:07:53 +00:00
Makefile.in merge conflicts between file-5.43 and file-5.45 2023-08-18 19:00:10 +00:00
README.md
example.py
magic.py Import file-5.43+; last was file-5.40 2022-09-24 20:07:53 +00:00
setup.py
tests.py Import file-5.43+; last was file-5.40 2022-09-24 20:07:53 +00:00

README.md

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