title: python file read "int too large to convert to c long"
body: <p>On my (presumably 64-bit Windows, 64-bit 2.7 python) installation, the file read function is using a 4 byte c_long (signed long).
  I tested the base python file read function and I can't pass in an offset of more than the max signed long integer value (2,147,483,647). Not sure if this is due to a problem with my python installation, or if this is truly the max limit for reading from a file in python...</p>
  
  <p>My test code is below:</p>
  
  <pre><code>import sys
  import platform
  
  inFileName = r'C:\Projects\Tampa\LASPY_EVLR\LAS_DATA\input\Large_LAS\20505.las'
  bit32_offset_signedlong = 2147483647
  
  print("python version: " + sys.version)
  print("platform: " + str(platform.architecture()))
  print("------------------------------")
  
  fileref = open(inFileName, "r")
  
  print("starting 32bit max read")
  datpart_32bitmax = fileref.read(bit32_offset_signedlong)
  print("------------------------------")
  
  print("starting 32bit max plus one read")
  datpart_32bitmaxplus1 = fileref.read(bit32_offset_signedlong + 1)
  print("------------------------------")
  </code></pre>
  
  <p>This produces output like this:</p>
  
  <pre><code>python version: 2.7.12 |Continuum Analytics, Inc.| (default, Jun 29 2016, 11:07:13) [MSC v.1500 64 bit (AMD64)]
  platform: ('64bit', 'WindowsPE')
  ------------------------------
  starting 32bit max read
  ------------------------------
  starting 32bit max plus one read
  Traceback (most recent call last):
    File "C:\Projects\Tampa\LASPY_EVLR\check_clong.py", line 18, in &lt;module&gt;
      datpart_32bitmaxplus1 = fileref.read(bit32_offset_signedlong + 1)
  OverflowError: Python int too large to convert to C long
  Press any key to continue . . .
  </code></pre>
  
  <p>Is this normal?  I thought that python could read an "unlimited" file size (solely limited by available RAM and OS bit size) as discussed here:
  <a href="https://stackoverflow.com/questions/7134338/max-size-of-a-file-python-can-open">Max size of a file Python can open?</a></p>
  
  <p>I should make clear that this issue only shows up when using the offset parameter of the read method.  I can read and write files larger than the 32-bit signed integer size, just when I try to read a portion of the file using the read offset parameter then the overflow error shows up. My end goal is to append some data near the tail end of the very large (6GB) file.</p>
  
  <p>Is there something wrong with my python installation? If so, maybe there is something I can do to fix this issue...</p>