This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: zipfile and big zipped file
Type: Stage:
Components: Library (Lib) Versions: Python 2.3
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: alanmcintyre, keyphrene, loewis
Priority: normal Keywords: patch

Created on 2004-07-17 07:45 by keyphrene, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
zipfile.py.diff keyphrene, 2004-07-17 07:45 readFile
Messages (5)
msg46379 - (view) Author: Keyphrene (keyphrene) Date: 2004-07-17 07:45
read method decompress the zipped files, but this
method returns bytes, more the file is big, more the
bytes array is big. readFile method allows to send the
bytes in a file.
msg46380 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2004-08-18 13:13
Logged In: YES 
user_id=21627

The patch is unacceptable in its current form. It duplicates
too much code; read and readfile should really share the
common code (e.g. by read falling back to readfile).

Also, as this really copies the data to fileobj, it probably
is better called copyfile, instead of readfile.

Finally, I would much prefer if zipfile would have an .open
method, returning a file-like object. Then you would have
such implementations

  def read(self, name):
      return self.open(name, "r").read()

  def readfile(self, name, dest):
      import shutil
      shutil.copyfileobj(self.open(name,"r"), dest)

I would then probably leave the last method out, and
encourage users to invoke shutil.copyfileobj directly if
desired.

Are you willing to make changes in this direction?
msg46381 - (view) Author: Alan McIntyre (alanmcintyre) * (Python committer) Date: 2005-02-09 22:29
Logged In: YES 
user_id=1115903

The current behavior of ZipFile.read is an occasional
annoyance for me.  I will make the changes described in
loewis' comments and submit the updated patch, unless
somebody is already working on it.
msg46382 - (view) Author: Alan McIntyre (alanmcintyre) * (Python committer) Date: 2005-02-11 01:32
Logged In: YES 
user_id=1115903

Ok, I ended up just starting from scratch and implementing a
file-like class - it just implements read([size]) right now
- and an instance of this class is returned when you call
ZipFile.open.  ZipFile.read was modified to use open(), as
loewis suggested. I also added some code to test_zipfile.py
to check the new open function, and tried using it to
extract a 690MB file from a ZIP with copyfileobj.  It seems
to be working ok.

Since I can't get into CVS at the moment, I don't have diff
files to post.  Even if I did, I don't see an option for me
to post them to this patch.  Should I post them as a new patch?

msg46383 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2007-02-13 09:01
It seems that this patch was superceded by 1121142, so closing it as out-of-date.
History
Date User Action Args
2022-04-11 14:56:05adminsetgithub: 40586
2004-07-17 07:45:39keyphrenecreate