tar files

Steve Holden sholden at holdenweb.com
Tue Dec 19 14:07:17 CET 2000


Rodrigo Senra <rodsenra at correionet.com.br> wrote in message
news:mailman.977177822.8335.python-list at python.org...
> Vetle Roeim wrote:
> >
> > * M. J. Fisher
> > > Hi,
> > >
> > > I am trying to find some code for unpacking tarred files and I am not
> > > sure why to look, does anybody have any ideas? I would also appreciate
> > > an example if any one had one,
> >
> > well.. I started making a tar-module in pure Python, but I never had
> > time to finish it. you can use it if you want, and is able to
> > understand it.. it was written wuick and dirty by examining the
> > documentation and source code of GNU Tar.
>
> Couldn't the 'tar functionality' be achieved by using
> the zipfile module without setting ZIP_DEFLATED ?
>
bzzzzt.

A simple experiment shows this is not true:

>>> import zipfile
>>> z = zipfile.ZipFile(r"C:\Temp\metakit-2_01.tar")
Traceback (innermost last):
  File "<interactive input>", line 1, in ?
  File "d:\python20\lib\zipfile.py", line 113, in __init__
    self._GetContents()
  File "d:\python20\lib\zipfile.py", line 137, in _GetContents
    raise BadZipfile, "File is not a zip file, or ends with a comment"
BadZipfile: File is not a zip file, or ends with a comment
>>>

The default compression is ZIP_STORED.  While WinZip, having been programmed
to know about tar files, can handle this file, the ZipFile module clearly
can't.

regards
 Steve






More information about the Python-list mailing list