473,385 Members | 1,593 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

zipfile library - problem..

Hi,
I'm working to create a backup function for a software; in particular,
from a directory with 12300 files (Jpg, medium size = 250KB / total size
= 2.90GB), i have to create a zip file.

I've decided to use the standard "zipfile" library to do that.
This is the code:

zipName = path.join(config.get('server.xbakPath'), 'backup.zip')
fileExport = zipfile.ZipFile(zipName,'w',zipfile.ZIP_DEFLATED)

#Insert images
listaImg = listdir( config.get('server.iPath') )
for file in listaImg:
if not path.isdir(path.join(config.get('server.iPath'), file)):
fileExport.write(path.join(config.get('server.iPat h'), file), \
file)

#close ZIP
fileExport.close()

Unfortunately, after few minutes, i see this error message:
Traceback (most recent call last):
File "C:\Python24\Lib\site-packages\cherrypy\_cphttptools.py", line
256, in run
main()
File "C:\Python24\Lib\site-packages\cherrypy\_cphttptools.py", line
452, in main
body = func(*(virtualPathList + cherrypy.request.paramList),
File "C:\pagine\utilities.py", line 162, in exportdati
fileExport.close()
File "C:\Python24\lib\zipfile.py", line 503, in close
zinfo.header_offset)
OverflowError: long int too large to convert to int

Reading the error I've known that the error is generated calling
"fileExport.close()", that calls the zipfile module,
and into that module there is an exception.

For information: when code stops, the zip file has size = 3.177.950.237
byte, but this size doesn't exceed ZIP limits:

the limits of ZIP files according to the folks who make info-zip:
http://www.info-zip.org/pub/in fozip/FAQ.html#limits

statistic limit
number of files 65,536
uncompressed size of a single file 4 GB
compressed size of a single file 4 GB
total size of archive 256 TB
maximum path/filename length 64 KB

Have you any idea?
Oh, the O.S. is WinXP Pro

Thank you!.
Renzo
Aug 11 '05 #1
2 1533
Renzo ha scritto:
<cut all>
I've seen that the error is a known bug:

"zipfile still has 2GB boundary bug"
<http://mail.python.org/pipermail/python-dev/2005-April/052887.html>

so I've used the module TarFile instead ZipFile, and now the script
works perfectly.

Thanks to Deelan and Manlio Perillo (i.c.l.p.)

Renzo
Aug 11 '05 #2
Renzo wrote:
Renzo ha scritto:
<cut all>
I've seen that the error is a known bug:

"zipfile still has 2GB boundary bug"
<http://mail.python.org/pipermail/python-dev/2005-April/052887.html>

so I've used the module TarFile instead ZipFile, and now the script
works perfectly.


Thanks; good to know. Looks like people are working on this
Python library bug. Next after that, we'll need to fix the zip
format. The 4GB limit on contained files and 256TB limit on
archives both looked astronomical at the time they were defined.
Sorry to sound like an old guy, but wow, how times change.

Incidentally, since your files are jpegs, they're already
compressed, and thus TarFile should be just as good as ZipFile
anyway.
--
--Bryan
Aug 11 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: LC | last post by:
Hi, I'm having a problem using the zipfile module in Windows 2000 sp4. When I use it to zip a small file it works fine, but large file doesnt. Here's the error msg i get......
19
by: Gerson Kurz | last post by:
AAAAAAAARG I hate the way python handles unicode. Here is a nice problem for y'all to enjoy: say you have a variable thats unicode directory = u"c:\temp" Its unicode not because you want it...
6
by: Bennie | last post by:
Hi, I have a problem with ZipFile. It works okay untily I come across a file that is greater then 1Gb. Then it exit with the error: OverflowError: long int too large to convert to int How...
11
by: Hari Sekhon | last post by:
I do import zipfile zip=zipfile.ZipFile('d:\somepath\cdimage.zip') zip.namelist() then either of the two: A) file('someimage.iso','w').write(zip.read('someimage.iso'))
15
by: Martin Maney | last post by:
To quote from zipfile.py (2.4 library): # Search the last END_BLOCK bytes of the file for the record signature. # The comment is appended to the ZIP file and has a 16 bit length. # So the...
12
by: xamdam | last post by:
Hi fellas, I am experiencing problems reading a 2GB zipfile consisting of multiple zipped files. I found a thread http://mail.python.org/pipermail/python-dev/2005-April/053027.html that mentions...
3
by: towers | last post by:
Hi I'm probably doing something stupid but I've run into a problem whereby I'm trying to add a csv file to a zip archive - see example code below. The csv just has several rows with carriage...
5
by: Neil Crighton | last post by:
I'm using the zipfile library to read a zip file in Windows, and it seems to be adding too many newlines to extracted files. I've found that for extracted text-encoded files, removing all instances...
1
by: John Machin | last post by:
On Jun 4, 8:06 pm, jwesonga <crazylun...@gmail.comwrote: Nothing is ever as it seems. Let's try to work backwards from the error message ... and we don't need your magnificent script, just the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.