zipfile doesn't compress very good, are there other solutions?

R. David Murray rdmurray at bitdance.com
Fri Jun 12 13:13:47 EDT 2009


Chris Rebert <clp2 at rebertia.com> wrote:
> On Thu, Jun 11, 2009 at 1:41 PM, Stef Mientki<stef.mientki at gmail.com> wrote:
> > Peter Otten wrote:
> >> Stef Mientki wrote:
> >>> Peter Otten wrote:
> >>>> Stef Mientki wrote:
> >>>>> I packed all sources with zipfile,
> >>>>> but the compression doesn't seem to be very good.
> >>>>>
> >>>>
> >>>> If you don't specify the compression, the files are not compressed at
> >>>> all. Just in case you didn't know...
> >>>>
> >>>
> >>> .. and would you be willing to tell me how I could set the compression (
> >>> at maximum) ?
> >>>
> >>
> >> According to the documentation (hint, hint) there is only on and off.
> >>
> >> zipfile.ZipFile(filename, "w", compression=zipfile.ZIP_DEFLATED)
> >>
> >>
> >
> > sorry guys I made a mistake,
> > I did read the doc, but as there was no default value metioned,
> 
> Erm...
> 
> class zipfile.ZipFile(file[, mode[, compression[, allowZip64]]])
> 
>     Open a ZIP file [...] compression is the ZIP compression method to
> use when writing the archive, and should be ZIP_STORED or
> ZIP_DEFLATED; [...] The default is ZIP_STORED. [...]
> 
> Though I admit the docs could definitely do with having
> "compression=ZIP_STORED" in the signature part of the doc.

Georg's been fixing the method signatures bit by bit to use keyword style.
Doc patches would be welcome to help speed up the conversion process.

--David




More information about the Python-list mailing list