I created a zip file with Gnome Archive Manager (Ubuntu OS). I created the zip file with a password and I am trying to unzip it using the zipfile Python library:
import zipfile file_name = '/home/mahmoud/Desktop/tester.zip' pswd = 'pass' with zipfile.ZipFile(file_name, 'r') as zf: zf.printdir() zf.extractall(path='/home/mahmoud/Desktop/testfolder', pwd = bytes(pswd, 'utf-8')) When I run this code I get the following error and I am pretty sure that the password is correct. The error is:
File "/home/mahmoud/anaconda3/lib/python3.7/zipfile.py", line 1538, in open raise RuntimeError("Bad password for file %r" % name) RuntimeError: Bad password for file <ZipInfo filename='NegSkew.pdf' compress_type=99 filemode='-rw-rw-r--' external_attr=0x8020 file_size=233252 compress_size=199427> How can I unzip the file?
extractall, I am seeingBad password for file <ZipInfo filename='sample.txt' ...>. This is definitely getting an up-vote from me, and I am going to poke at it a bit. I am inclined to think that Python's builtin ZIP library may not support the encryption algo used by Gnome's Archive Manager, but I don't have any thing to back that up yet.