This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Bad Password for file using zipfile module
Type: Stage:
Components: Extension Modules Versions: Python 3.5
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: shivaprasanth
Priority: normal Keywords:

Created on 2015-08-17 00:52 by shivaprasanth, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
raj shivaprasanth, 2015-08-17 00:52 entered
Messages (2)
msg248698 - (view) Author: shiva prasanth (shivaprasanth) * Date: 2015-08-17 00:52
i created a zip file with password as getlost using Archive Manager which comes with ubuntu.
and when i try to extract the same file using zipfile module which comes with python2.7 with same password it is showing error as 
"Bad Password for file" which is absurd.
it should either give response of cant decrypt zipfile or some other.
when i try to do it with terminal command  

$zip --encrypt file.zip file

and upon entering the password it is working

my main point is it should not show Bad Password for file and 
and it should extractall
msg248699 - (view) Author: shiva prasanth (shivaprasanth) * Date: 2015-08-17 00:53
Python 2.7.9 (default, Apr  2 2015, 15:33:21) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import zipfile
>>> s=zipfile.ZipFile('random.zip')
>>> s.extractall(pwd='getlost')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/zipfile.py", line 1040, in extractall
    self.extract(zipinfo, path, pwd)
  File "/usr/lib/python2.7/zipfile.py", line 1028, in extract
    return self._extract_member(member, path, pwd)
  File "/usr/lib/python2.7/zipfile.py", line 1082, in _extract_member
    with self.open(member, pwd=pwd) as source, \
  File "/usr/lib/python2.7/zipfile.py", line 1007, in open
    raise RuntimeError("Bad password for file", name)
RuntimeError: ('Bad password for file', <zipfile.ZipInfo object at 0x7faf1d1921e0>)
History
Date User Action Args
2022-04-11 14:58:19adminsetgithub: 69065
2015-08-19 13:09:34shivaprasanthsetstatus: open -> closed
2015-08-18 16:13:18shivaprasanthsetstatus: closed -> open
type: compile error ->
2015-08-17 17:20:37shivaprasanthsetstatus: open -> closed
2015-08-17 15:09:29shivaprasanthsettype: compile error
versions: + Python 3.5, - Python 2.7
2015-08-17 00:53:47shivaprasanthsetmessages: + msg248699
2015-08-17 00:52:02shivaprasanthcreate