title: Zipfile module error: File is not a zip file
body: <p>I have this code:</p>
  
  <pre><code># File: zipfile-example-1.py
  
  import zipfile,os,glob
  
  file = zipfile.ZipFile("Apap.zip", "w")
  
  # list filenames
  for name in glob.glob("C:\Users/*"):
      print name
      file.write(name,os.path.basename(name),zipfile.ZIP_DEFLATED)
  file = zipfile.ZipFile("Apap.zip", "r")
  for info in file.infolist():
      print info.filename, info.date_time, info.file_size, info.compress_size
  </code></pre>
  
  <p>which produces this error: </p>
  
  <pre><code>raceback (most recent call last):
    File "C:/Users/Desktop/zip.py", line 11, in &lt;module&gt;
      file = zipfile.ZipFile("Apap.zip", "r")
    File "C:\Python27\lib\zipfile.py", line 712, in __init__
      self._GetContents()
    File "C:\Python27\lib\zipfile.py", line 746, in _GetContents
      self._RealGetContents()
    File "C:\Python27\lib\zipfile.py", line 761, in _RealGetContents
      raise BadZipfile, "File is not a zip file"
  BadZipfile: File is not a zip file
  </code></pre>
  
  <p>Anybody know why this error is occurring?</p>