[ python-Bugs-849218 ] ZipInfo shows incorrect file size for large
files
SourceForge.net
noreply at sourceforge.net
Tue Nov 25 15:09:29 EST 2003
Bugs item #849218, was opened at 2003-11-25 13:09
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=849218&group_id=5470
Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Waldemar Osuch (osuchw)
Assigned to: Nobody/Anonymous (nobody)
Summary: ZipInfo shows incorrect file size for large files
Initial Comment:
When dealing with large zipped files I've noticed that
ZipInfo instance was reporting incorrect file size.
I could reproduce the error by:
txtfile = file('bigone.txt','w')
for i in xrange(10**8):
txtfile.write('%-9s Hello World\n'%i)
txtfile.close()
os.stat('bigone.txt').st_size
2300000000L
Now I zip the bugger and:
z = zipfile.ZipFile(file('bigone.zip','r'))
fi = z.infolist()[0]
fi.file_size
-1994967296
After changing zipfile.py on line 26 from:
structCentralDir = "<4s4B4H3l5HLl"
to:
structCentralDir = "<4s4B4H3L5HLl"
I get:
z = zipfile.ZipFile(file('bigone.zip','r'))
fi = z.infolist()[0]
fi.file_size
2300000000L
Sorry for a digression but it would be nice to have
something similar to a module from Twisted distribution
(twisted.python.zipstream) in standard library.
The above module allows to read a zipped file in chunks
using iterator. It would help tremendously when
dealing with large files.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=849218&group_id=5470
More information about the Python-bugs-list
mailing list