title: Python OSError: Bad address when reading from large file
body: <p>I am observing a "Bad address" <code>OSError</code> when reading from a file handle created using the <code>with</code> syntax in Python 3.</p>
  
  <p>The file in question is 39G, but I should have enough RAM available to read the whole file. The error message leads me to believe I am hitting some kind of OS restriction; I am running CentOS 6.9.  Can anyone help me understand what might be causing this behavior?</p>
  
  <p>The file is perfectly readable outside of python, e.g. in bash with <code>head</code> or <code>vim</code>.</p>
  
  <p>Simplified code sample producing the error is shown below:</p>
  
  <pre><code>In [2]: with open(filename, 'r', encoding="utf8") as infile:
     ...:     infile.read()
     ...:     
  ---------------------------------------------------------------------------
  OSError                                   Traceback (most recent call last)
  &lt;ipython-input-2-3f216811bec7&gt; in &lt;module&gt;()
    1 with open(filename, 'r', encoding="utf8") as infile:
  ----&gt; 2     infile.read()
    3 
  
  OSError: [Errno 14] Bad address
  </code></pre>