title: Python 2.5.2- what was instead of 'with' statement
body: <p>I wrote my code for python 2.7 but the server has 2.5. How do i rewrite the next code so it will run in python 2.5.2:</p>
  
  <pre><code>gzipHandler = gzip.open(gzipFile)
  
  try:
      with open(txtFile, 'w') as out:
          for line in gzipHandler:
              out.write(line)
  except: 
      pass
  </code></pre>
  
  <p>Right now, when i try to run my script I get this error:</p>
  
  <blockquote>
    <p>Warning: 'with' will become a reserved keyword in Python 2.6 Traceback
    (most recent call last):   File "Main.py", line 7, in 
        from Extractor import Extractor   File "/data/client/scripts/Extractor.py", line 29
        with open(self._logFile, 'w') as out:
                ^ SyntaxError: invalid syntax</p>
  </blockquote>
  
  <p>Thanks,
  Ron.</p>