title: GzipFile instance has no attribute '__exit__' when used in a "with:" block
body: <p>I need to process a .gz file with Python.</p>
  <p>I pass the filename into my Python script with:</p>
  <pre class="lang-py prettyprint-override"><code>infile = sys.argv[1]
  
  with gzip.open(infile, 'rb') as f:
      logfile = f.read()
  </code></pre>
  <p>which gives me:</p>
  <pre class="lang-none prettyprint-override"><code>with gzip.open(infile, 'rb') as f:
  AttributeError: GzipFile instance has no attribute '__exit__'
  </code></pre>
  <p>If I manually gunzip my .gz file and then pass that to my Python script, all works fine.</p>
  <pre class="lang-py prettyprint-override"><code>logfile = open(infile, 'r').read()
  </code></pre>
  <p>NB: I'm using Python 2.6.6 (r266:84292, Aug 18 2016, 15:13:37). I don't have the ability to update Python on this computer. How can I process a gzipped text file with Python 2.6?</p>