0

When using the python module zipfile, for some reason I don't know I can't set a password for an archive created.

When trying to unzip following empty zip archive, I can do so without prompting a password..

Here is my code, what's wrong?

import zipfile  
with zipfile.ZipFile("1.zip","w") as zip:
    zip.setpassword("1234")
Dharman
  • 30,962
  • 25
  • 85
  • 135
JavaSa
  • 5,813
  • 16
  • 71
  • 121

1 Answers1

2

From documentation for zipfile module

It supports decryption of encrypted files in ZIP archives, but it currently cannot create an encrypted file.

Dima Kudosh
  • 7,126
  • 4
  • 36
  • 46