tarfile doesn't work with tgz files?

Robert Dailey rcdailey at gmail.com
Sat May 16 12:47:25 EDT 2009

On May 16, 11:33 am, Robert Dailey <rcdai... at gmail.com> wrote:
> Hi,
> I'm not a big expert on the tarfile component, but I assumed that .tgz
> files were short for .tar.gz and the format was the same. When I try
> to extract a .tgz file using tarfile in Python 3.0 on Windows, I get
> the following error:
>   File "C:\Python30\lib\tarfile.py", line 1630, in open
>     raise ReadError("file could not be opened successfully")
> tarfile.ReadError: file could not be opened successfully
> I'm assuming this is because the .tgz format is not what I think it is
> and is not supported. How can I extract .tgz files using Python 3.0?
> Note that I probably can't depend on third party python modules, since
> I have yet to find many that support Python 3.0.
> Thanks.

Correction, it is the following line that breaks:

tarfile.open( file )

When I try to *open* the file it fails, not extract. Sorry for the

More information about the Python-list mailing list