I am using python's standard library, zipfile, to test an archive:
zf = zipfile.ZipFile(archive_name)
if zf.testzip()==None: checksum_OK=True
And I am getting this Runtime exception:
File "./packaging.py", line 36, in test_wgt
if zf.testzip()==None: checksum_OK=True
File "/usr/lib/python2.7/zipfile.py", line 844, in testzip
f = self.open(zinfo.filename, "r")
File "/usr/lib/python2.7/zipfile.py", line 915, in open
"password required for extraction" % name
RuntimeError: File xxxxx/xxxxxxxx.xxx is encrypted, password required for extraction
How can I test, before I run testzip(), if the zip is encrypted? I didn't found an exception to catch that would make this job simpler.