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
  • 26,923
  • 21
  • 73
  • 125
JavaSa
  • 5,223
  • 15
  • 62
  • 106

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
  • 6,456
  • 4
  • 34
  • 46