tarfile.py question
Steve Holden
sholden at holdenweb.com
Sat Jul 27 00:00:55 EDT 2002
More information about the Python-list mailing list
Sat Jul 27 00:00:55 EDT 2002
- Previous message (by thread): tarfile.py question
- Next message (by thread): Window does not resize it's components
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Adonis" <deltapigz at telocity.com> wrote in message news:3d41619d$1_2 at nopics.sjc... > i have downloaded tarfile.py by Lars Gustäbel and have trouble reading > tar.gz files. i am using the following code: > > import tarfile, sys > > if len(sys.argv) == 1: > print 'usage: untar <filename.tar[.gz]> <dest_dir>' > sys.exit() > > x = tarfile.TarFile(sys.argv[1], 'r') > tarfile.errorlevel = 1 > tarfile.debug = 3 > m = x.getmembers() > for i in m: > x.extract(i, sys.argv[2]) > x.close() > > i attempted to read a tar.gz file (gadfly) and when i load it no error is > posted nor any information at that, but the m variable is an empty list, > and if i attempted to do x.list() to get a list of files it returns None, > although it seems that it loaded the tar file properly no IOError was > generated, is there something i am missing? i have tested this by generating > a tar.gz file using the same module and it unpacked properly. > You need to ask yourself about the source of the "tar" files. Some web sites and browsers combine to use on-the-fly decompression, but if the client is clueless you can end up with an uncompressed file named "xxx.tar.gz" (for some reason this always seems to happen with Marc-Andre Lemburg's alpha and beta release files). So you should verify that your file really *is* both compressed and a tar file. See below for a suggestion as to how you might do this. > any help is greatly appreciated. > We do our best. Only you can say whether it's help :-) > Adonis > > note: im a windows user so i have no tar archiving present. > This may be the problem you should sove first. I'm an enthusiastic Cygwin user (see http://www.cygwin.com/), and that includes tar as one of the many Unix goodies you will suddenly find are available. "file" would be even more useful in this case. Just because you use Windows doesn't mean you can't get many of Unix's advantages too, you know! Hope this helps. regards ----------------------------------------------------------------------- Steve Holden http://www.holdenweb.com/ Python Web Programming http://pydish.holdenweb.com/pwp/ -----------------------------------------------------------------------
- Previous message (by thread): tarfile.py question
- Next message (by thread): Window does not resize it's components
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list