J
John Salerno
Here's the name of a file I have: wxPython-newdocs-2.6.3.3.tar.bz2
Now, I tried this:
import tarfile
tar = tarfile.open('wxPython-newdocs-2.6.3.3.tar.bz2', 'r:bz2')
but got this:
Traceback (most recent call last):
File "<pyshell#5>", line 1, in -toplevel-
tar = tarfile.open('wxPython-newdocs-2.6.3.3.tar.bz2', 'r:bz2')
File "C:\Python24\lib\tarfile.py", line 901, in open
return func(name, filemode, fileobj)
File "C:\Python24\lib\tarfile.py", line 1006, in bz2open
raise ReadError, "not a bzip2 file"
ReadError: not a bzip2 file
So I'm a little confused. When dealing with a tar.gz or tar.bz2 file, do
you need to uncompress it first with the proper module (gzip or bz2)? Or
does tarfile take care of this? If so, why doesn't it recognize the
above file? Or am I just doing it the wrong way? (I'm following an
example in the docs)
Now, I tried this:
import tarfile
tar = tarfile.open('wxPython-newdocs-2.6.3.3.tar.bz2', 'r:bz2')
but got this:
Traceback (most recent call last):
File "<pyshell#5>", line 1, in -toplevel-
tar = tarfile.open('wxPython-newdocs-2.6.3.3.tar.bz2', 'r:bz2')
File "C:\Python24\lib\tarfile.py", line 901, in open
return func(name, filemode, fileobj)
File "C:\Python24\lib\tarfile.py", line 1006, in bz2open
raise ReadError, "not a bzip2 file"
ReadError: not a bzip2 file
So I'm a little confused. When dealing with a tar.gz or tar.bz2 file, do
you need to uncompress it first with the proper module (gzip or bz2)? Or
does tarfile take care of this? If so, why doesn't it recognize the
above file? Or am I just doing it the wrong way? (I'm following an
example in the docs)