title: AttributeError: 'Pool' object has no attribute '__exit__'
body: <p>I'm doing some multiprocessing python scripts using <code>multiprocessing.Pool</code>. These scripts look like the following:</p>
  
  <pre><code>from multiprocessing import Pool
  
  def f(x):
      return x*x
  
  if __name__ == '__main__':
      with Pool(processes=4) as pool:         # start 4 worker processes
          print(pool.map(f, range(10)))       # prints "[0, 1, 4,..., 81]"
  </code></pre>
  
  <p>When running this with Python 3.4, everything is fine. However, when using Python <strong>2.6</strong> or <strong>3.1</strong> I get this error:</p>
  
  <pre><code>AttributeError: 'Pool' object has no attribute '__exit__'
  </code></pre>
  
  <p>Using Python <strong>2.7</strong> or <strong>3.2</strong>, the error is essentially the same:</p>
  
  <pre><code>AttributeError: __exit__
  </code></pre>
  
  <p>Why does this happen and how can I circumvent this?</p>