title: Bad magic number error with ZipFile module in Python
body: <p>I am using Python 2.7 on Windows 7 (64 bit).
  When I try to unzip a zip file with ZipFile module I get the following error:-</p>
  
  <pre><code>Traceback (most recent call last):
    File "unzip.py", line 8, in &lt;module&gt;
      z.extract(name)
    File "C:\Python27\lib\zipfile.py", line 950, in extract
      return self._extract_member(member, path, pwd)
    File "C:\Python27\lib\zipfile.py", line 993, in _extract_member
      source = self.open(member, pwd=pwd)
    File "C:\Python27\lib\zipfile.py", line 897, in open
      raise BadZipfile, "Bad magic number for file header"
  zipfile.BadZipfile: Bad magic number for file header
  </code></pre>
  
  <p>WinRAR could extract the file I am trying to extract just fine.
  Here is the code I used to extract files from <code>myzip.zip</code>   </p>
  
  <pre><code>from zipfile import ZipFile
  z = ZipFile('myzip.zip')   //myzip.zip contains just one file, a password protected pdf        
  for name in z.namelist():
      z.extract(name)
  </code></pre>
  
  <p>This code is working fine for many other zip files I created using WinRAR but <code>myzip.zip</code></p>
  
  <p>I tried commenting the following lines in <code>Python27\Lib\zipfile.py</code>:-</p>
  
  <pre><code>if fheader[0:4] != stringFileHeader:
     raise BadZipfile, "Bad magic number for file header"
  </code></pre>
  
  <p>But this didn't really help. Running my code with this in effect, I get some dump on my shell.</p>