title: Python - the zipfile module doesn't seem to work with passwords
body: <p>I've been trying to implement a very simple script, extracting zip files that are password protected.
  I have created a simple zip file (test.zip) with the password "1234" containing 2 text files (1.txt, 2.txt) and i wrote this script:</p>
  
  <pre><code>import zipfile
  
  PASSWORD = "1234"
  
  zip = zipfile.ZipFile("test.zip", "r")
  zip.setpassword(PASSWORD)
  zip.extractall()
  zip.close()
  </code></pre>
  
  <p>and i'm getting the following Runtime error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "test.py", line 7, in &lt;module&gt;
      zip.extractall()
    File "/usr/lib/python2.7/zipfile.py", line 962, in extractall
      self.extract(zipinfo, path, pwd)
    File "/usr/lib/python2.7/zipfile.py", line 950, in extract
      return self._extract_member(member, path, pwd)
    File "/usr/lib/python2.7/zipfile.py", line 993, in _extract_member
      source = self.open(member, pwd=pwd)
    File "/usr/lib/python2.7/zipfile.py", line 934, in open
      raise RuntimeError("Bad password for file", name)
  RuntimeError: ('Bad password for file', &lt;zipfile.ZipInfo object at 0x1f3f2a8&gt;)
  </code></pre>
  
  <p>I've tried iterating using "zip.namelist()" and the "extract()" method + specifying the exact parameters as follows:</p>
  
  <pre><code>zip.extract(&lt;file_name&gt;, path=&lt;path&gt;, pwd=&lt;password&gt;)
  </code></pre>
  
  <p>with no luck :(
  I know about the security issue with "extractall()" and in my complete code i will have verification prior to the extracting process, i'm just trying to figure out what am i doing wrong?</p>
  
  <p>Thanks for the help in advance! </p>