title: unzipping file results in "BadZipFile: File is not a zip file"
body: <p>I have two zip files, both of them open well with Windows Explorer and 7-zip. </p>
  
  <p>However when i open them with Python's zipfile module [ zipfile.ZipFile("filex.zip") ], one of them gets opened but the other one gives error "<code>BadZipfile: File is not a zip file</code>".</p>
  
  <p>I've made sure that the latter one is a valid Zip File by opening it with 7-Zip and looking at its properties (says 7Zip.ZIP). When I open the file with a text editor, the first two characters are "PK", showing that it is indeed a zip file.</p>
  
  <p>I'm using Python 2.5 and really don't have any clue how to go about for this. I've tried it both with Windows as well as Ubuntu and problem exists on both platforms.</p>
  
  <p><strong>Update:</strong> Traceback from Python 2.5.4 on Windows:</p>
  
  <pre><code>Traceback (most recent call last):
  File "&lt;module1&gt;", line 5, in &lt;module&gt;
      zipfile.ZipFile("c:/temp/test.zip")
  File "C:\Python25\lib\zipfile.py", line 346, in init
      self._GetContents()
  File "C:\Python25\lib\zipfile.py", line 366, in _GetContents
      self._RealGetContents()
  File "C:\Python25\lib\zipfile.py", line 378, in _RealGetContents
      raise BadZipfile, "File is not a zip file"
  BadZipfile: File is not a zip file
  </code></pre>
  
  <p>Basically when the <code>_EndRecData</code> function is called for getting data from End of Central Directory" record, the comment length checkout fails [ endrec[7] == len(comment) ]. </p>
  
  <p>The values of locals in the <code>_EndRecData</code> function are as following:</p>
  
  <pre><code> END_BLOCK: 4096,
   comment: '\x00',
   data: '\xd6\xf6\x03\x00\x88,N8?&lt;e\xf0q\xa8\x1cwK\x87\x0c(\x82a\xee\xc61N\'1qN\x0b\x16K-\x9d\xd57w\x0f\xa31n\xf3dN\x9e\xb1s\xffu\xd1\.....', (truncated)
   endrec: ['PK\x05\x06', 0, 0, 4, 4, 268, 199515, 0],
   filesize: 199806L,
   fpin: &lt;open file 'c:/temp/test.zip', mode 'rb' at 0x045D4F98&gt;,
   start: 4073
  </code></pre>