Message60430
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. |
|
Date |
User |
Action |
Args |
2008-01-20 09:56:35 | admin | link | issue849218 messages |
2008-01-20 09:56:35 | admin | create | |
|