[Python-Dev] Lack of sequential decompression in the zipfile module

Alan McIntyre alan.mcintyre at gmail.com
Tue Feb 20 06:40:25 CET 2007


On 2/17/07, Alan McIntyre <alan.mcintyre at gmail.com> wrote:
> I ran into the same thing and made a patch a long while ago (the one
> Martin mentioned):
>
> https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1121142&group_id=5470
>
> I am actually working on it this weekend; if you'd like to exchange
> code/test cases/whatever feel free to send me your stuff.  I'll try to
> get a patch that works against the trunk posted today or tomorrow if
> you want to try it out.

Derek mentioned something that hadn't occurred to me: adding
ZipFile.open() is helpful, but if we don't provide something analogous
to TarFile.extract, anybody wanting to just extract a file from an
archive to disk will have to write their own "get and write chunks
from the file object" loop.

Since this is likely to be a common task, it makes sense to me to
provide this capability in the ZipFile class with an extract method
that takes an optional path argument (defaulting to the working
directory + path for file in archive). I'll add this to the patch
unless somebody greatly disagrees or has a better idea.


More information about the Python-Dev mailing list