Python 2.6: Opening 4GB file throws "IOError: [Errno 127] Value too large to be stored in data type" on AIX

StackOverflow https://stackoverflow.com/questions/21704904

  •  10-10-2022
  •  | 
  •  

Question

When opening 4GB+ file on AIX Python 2.6.2 I receive IOError:

>>> fd = open('/mnt/t/MY_BIG_4GB_FILE', 'r')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
IOError: [Errno 127] Value too large to be stored in data type: '/mnt/t/MY_BIG_4GB_FILE'

Any solutions? I didn't find information in Google.

EDIT: To read BIG file I do something line that (I know that it is rubbish but sometimes You simply can't change python version):

from subprocess import Popen, PIPE
p = Popen(["cat", source_file], stdout=PIPE, bufsize=BUFFER_SIZE)
try:
   for line in iter(p.stdout.readline, ''):
       # process line
       pass
finally:
   p.communicate()  # closing Popen
Was it helpful?

Solution

You're looking for "large file support." There is a decent brief here: http://docs.python.org/2/library/posix.html#large-file-support . You likely need to recompile your Python interpreter with the appropriate options, or find a pre-built one that has those options. Try a build of Python 2.7 if you can, while you're at it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top