compression level with tarfile (w:gz) ?

Esmail ebonak at
Mon Aug 10 16:55:42 CEST 2009

Hi Lars,

Lars Gustäbel wrote:
> How much smaller is it? I did a test with a recent Linux kernel source tree
> which made an archive of 337MB. Command-line gzip was ahead of Python's
> GzipFile() by just 20200 bytes(!) with an archive of about 74MB.
>> Is the only way to accomplish the higher rate to create a tar file
>> and then use a different module to gzip it (assuming I can specify
>> the compression level there)?
> If you need the disk space that badly, the alternative would be to pipe
> tarfile's output to command-line gzip somehow:

Thanks for the additional info and the workaround. I was mostly just
curious if there was a way to specify the compression level, so far
I'm ok with the generated file sizes, but it's good to know that there
are other options to specify my own compression level.

Thanks again,


More information about the Python-list mailing list