Re: Archives and magic bytes

2005-03-26 Thread andrea crotti
> Perhaps this is mostly a reflection on me as a programmer :-} but I > found the job surprisingly tricky. No I think you're right... It's not very important for me retrieve exactly what kind of file it is, it could be just something more in my little program (an organizer that put files in the rig

Re: Archives and magic bytes

2005-03-25 Thread Jim
This is something I've recently thought about; perhaps you wouldn't mind some points? 1) I've been running 'file' via os.popen, and I've had trouble with it incorrectly spotting file types (Fedora Core 1). I can name a specific example where it thinks a plain text README file is HTML (despite tha

Re: Archives and magic bytes

2005-03-24 Thread andrea
Chris Rebert (cybercobra) wrote: Have you tried the tarfile or zipfile modules? You might need to ugrade your python if you don't have them. They look pretty easy and should make this a snap. You can grab the output from the *nix "file" command using the new subprocess module. Good Luck - Chris ===

Re: Archives and magic bytes

2005-03-23 Thread Chris Rebert (cybercobra)
Have you tried the tarfile or zipfile modules? You might need to ugrade your python if you don't have them. They look pretty easy and should make this a snap. You can grab the output from the *nix "file" command using the new subprocess module. Good Luck - Chris === PYTHON POWERs all! All your

Re: Archives and magic bytes

2005-03-23 Thread Maxim Krikun
> Another thing, I work on linux (gentoo) and I would like to use the "file" command to retrieve informations about type of file instead of using extensions, do you think this can be done? this is trivial: >>> import os >>> os.popen("file /etc/passwd").read() '/etc/passwd: ASCII text\n' -- http

Archives and magic bytes

2005-03-23 Thread andrea
Hi everybody, this is my first post but I've read already many of yours interesting posts... (sorry for my bad english) Anyway for my little project I need a module that given an archive (zip, bz2, tar ...) gives me back the archive decompressed. I looked at the modules in the library reference