Skip to content Skip to sidebar Skip to footer

Unable To Extract Encrypted Zip File In Python

I'm not able to extract a password protected zip file using Python. Here is the snippet that I use: import os import subprocess import zipfile import sys # Step 1: Encrypt the fil

Solution 1:

I figured out how to do this!

subprocess.call(["/usr/local/Cellar/p7zip/16.02_1/bin/7z", "x", '-p{}'.format(passwd), "myarchive.zip"])

Seems like there is a bug with AES encryption and Python ZipFile!

Solution 2:

this may work.

f = zipfile.ZipFile('myarchive.zip').extractall(pwd=bytes(‘P4$$W0rd‘,'utf-8'))

Post a Comment for "Unable To Extract Encrypted Zip File In Python"