Thanks Mike this is really great! Regards, David
On Friday, September 23, 2005, at 11:55 AM, Mike Meyer wrote: > David Pratt <[EMAIL PROTECTED]> writes: >> Thanks Mike for your reply. I am not aware of libmagic and will look >> to see what it provides. > > and ... > > Skip Montanaro <[EMAIL PROTECTED]> writes: >> You can also run the file(1) command and see what it says. I seem >> to recall someone asking about the equivalent to file(1) implemented >> in >> Python awhile back. > > libmagic is the smarts of the file command. As I said before, people > have done Python wrappers for it. It uses a text database describing > how to recognize a files type - see the magic(5) man page for details > on that. If you use libmagic, you'll probably want to provide your own > version of the databse, excerpted to include just the file types you > want to recognize. > > You can check on whether or not this will work for you by seeing what > the file command says about your sample data. > > <mike > -- > Mike Meyer <[EMAIL PROTECTED]> > http://www.mired.org/home/mwm/ > Independent WWW/Perforce/FreeBSD/Unix consultant, email for more > information. > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list