title: Python zipfile - IOError: [Errno 2] No such file or directory : zip_file
body: <p><a href="https://pymotw.com/2/zipfile/" rel="nofollow">pyMOTW</a></p>
  
  <p>I need to create a ZIP file and save this file as binary in the database. I used reference from above website. My code is as below:</p>
  
  <pre><code>import time
  import zipfile
  import base64
  zip_file = 'some_file_name.zip'
  xml_file = 'xml_file.xml'
  zf = zipfile.ZipFile(zip_file, mode='w',)
  try:
     info = zipfile.ZipInfo(xml_file, 
                                     date_time=time.localtime(time.time()),
                                     )
     info.compress_type=zipfile.ZIP_DEFLATED
     info.comment='Remarks go here'
     info.create_system=0
     zf.writestr(info, "&lt;Some XML string&gt;")
  finally:
     zf.close()
  out = base64.encodestring(zf) # I need to convert zip into binary data in order to update this into database using ORM methods.
  </code></pre>
  
  <p>I don't need to read/write this zip file on File system. I just need to create it programmatically and convert it into binary.</p>
  
  <p>I'm getting this error on the line :  zf = zipfile.ZipFile(zip_file, mode='w',)
  Error traceback:</p>
  
  <pre><code>File "/usr/lib/python2.7/zipfile.py", line 756, in __init__
     self.fp = open(file, modeDict[mode])
  IOError: [Errno 2] No such file or directory: u'some_file_name.zip'
  </code></pre>
  
  <p>Sorry for my bad indentation. Please help me out of this. Thanks in advance.</p>