[New-bugs-announce] [issue6004] ZipFile.writestr "compression_type" argument

Ronald Oussoren report at bugs.python.org
Tue May 12 11:36:50 CEST 2009

New submission from Ronald Oussoren <ronaldoussoren at mac.com>:

Class zipfile.ZipFile has two methods for adding data to a zipfile: 
'write' and 'writestr'.

The former has a "compression_type" argument that can be used to specify 
the compression to be used. That latter doesn't have that argument.

Could a "compression_type" argument be added to "writestr" as well? I 
regularly create zipfiles from scratch using the writestr method to add 
content and currently have to modify the 'compression' attribute of the 
zipfile object to control compression and that leads to ugly code.

The other alternative is to use a ZipInfo object as the archive-name of 
the newly added file, but that leads to even uglier code.

messages: 87611
nosy: ronaldoussoren
severity: normal
stage: needs patch
status: open
title: ZipFile.writestr "compression_type" argument
type: feature request
versions: Python 2.7, Python 3.1, Python 3.2

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list