title: "OSError: [Errno 22] Invalid argument" when read()ing a huge file
body: <p>I'm trying to write a small script that prints the checksum of a file (using some code from <a href="https://gist.github.com/Zireael-N/ed36997fd1a967d78cb2" rel="noreferrer">https://gist.github.com/Zireael-N/ed36997fd1a967d78cb2</a>):</p>
  
  <pre><code>import sys
  import os
  import hashlib
  
  file = '/Users/Me/Downloads/2017-11-29-raspbian-stretch.img'
  
  with open(file, 'rb') as f:
      contents = f.read()
      print('SHA256 of file is %s' % hashlib.sha256(contents).hexdigest())
  </code></pre>
  
  <p>But I'm getting the following error message:</p>
  
  <pre><code>Traceback (most recent call last):
    File "checksum.py", line 8, in &lt;module&gt;
      contents = f.read()
  OSError: [Errno 22] Invalid argument
  </code></pre>
  
  <p>What am I doing wrong? I'm using python 3 on macOS High Sierra</p>