Question about Reading Files

Mats Rauhala mats.rauhala at gmail.com
Sun Sep 5 12:28:38 CEST 2010


On 2010-09-05, genxtech <jrmy.lnrd at gmail.com> wrote:
> I am using Fedora 13.  When I run the file command the response is
> that it is a 'data' file.  If there are any tips on how to
> programatically figure out the format, I would greatly appreciate it.

I tried python-magic from the fedora repositories, but was unable to get
it working. However there was another project at github [1] which seems
to be working, at least with python 2.6. An easy way to test whether it
works is by unpacking it, going to the directory, opening the
interactive shell and running 'import magic' and
'magic.from_file("testdata/test.pdf")'

See help(magic) for more help

[1] http://github.com/ahupp/python-magic



More information about the Python-list mailing list