Can't get compression in Python zip script.

Fredrik Lundh fredrik at pythonware.com
Mon May 2 16:28:37 EDT 2005


M.E.Farmer wrote:

> I saw compression=0 and assumed that 1 would mean true, but no!
> zipfile.ZIP_DEFLATED = 8, defies logic, it is the only compression type
> why not accept any non zero as compression.

"is the only compression type" ?  quoting from the ZIP specification:

     compression method: (2 bytes)

          (see accompanying documentation for algorithm
          descriptions)

          0 - The file is stored (no compression)
          1 - The file is Shrunk
          2 - The file is Reduced with compression factor 1
          3 - The file is Reduced with compression factor 2
          4 - The file is Reduced with compression factor 3
          5 - The file is Reduced with compression factor 4
          6 - The file is Imploded
          7 - Reserved for Tokenizing compression algorithm
          8 - The file is Deflated
          9 - Enhanced Deflating using Deflate64(tm)
         10 - PKWARE Data Compression Library Imploding
         11 - Reserved by PKWARE
         12 - File is compressed using BZIP2 algorithm

( http://www.pkware.com/company/standards/appnote/appnote.txt )

the current zipfile version only supports 0 and 8, but that doesn't mean that
future versions won't support other ZIP compressions.

</F> 






More information about the Python-list mailing list