tarfile.py question

Adonis deltapigz at telocity.com
Fri Jul 26 10:50:16 EDT 2002


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.

any help is greatly appreciated.

Adonis

note: im a windows user so i have no tar archiving present.





More information about the Python-list mailing list