1

I'm using this code for unzipping zipped password protected files:

with zipfile.ZipFile(folder_name+'\\'+each+'\\'+latest, "r") as z:
        z.extractall(folder_name+'\\'+each+'\\'+each,pwd=passwd)

This functionally works perfect, but is very slow. Is there any way to make unzipping fast?

HavelTheGreat
  • 3,299
  • 2
  • 15
  • 34
fhulprogrammer
  • 599
  • 2
  • 7
  • 16

1 Answers1

5

From the Python zipfile docs:

It supports decryption of encrypted files in ZIP archives, but it currently cannot create an encrypted file. Decryption is extremely slow as it is implemented in native Python rather than C.

To speed up password protected unzipping - you should probably shell out to a separate utility.

markm
  • 896
  • 9
  • 13
  • For the record: the decompression is still done in C code; only metadata handling and decryption are done in Python code, and it is the decryption that is slow. – Martijn Pieters Aug 21 '17 at 08:56