tarfile doesn't work with tgz files?

Kushal Kumaran kushal.kumaran at gmail.com
Sat May 16 18:46:01 CEST 2009


On Sat, May 16, 2009 at 10:03 PM, Robert Dailey <rcdailey 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.
>

Is the file itself correct?  Are you able to extract the files using
any compression program?  Do you have a version of tar installed that
you can try extracting the file with?  If you don't, a Windows version
of tar will be available with cygwin.

-- 
kushal



More information about the Python-list mailing list