[Tutor] Zip - password protect

Emile van Sebille emile at fenx.com
Tue Aug 23 19:42:03 CEST 2011


On 8/23/2011 10:19 AM James Reynolds said...
> Does anyone know if a way to password protect a zip file? I have no
> issues creating the zip file, but I would like to password protect as
> well. I'm aware of a commercial solution, but I would like something
> open source.
>


The standard zipfile library includes a setpassword option.

help(zipfile.PyZipFile.setpassword)

Help on method setpassword in module zipfile:

setpassword(self, pwd) unbound zipfile.PyZipFile method
     Set default password for encrypted files.


Emile






More information about the Tutor mailing list