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

标签 python python-2.6

在 AIX Python 2.6.2 上打开 4GB+ 文件时,我收到 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'

有什么解决办法吗?我在 Google 中没有找到信息。

编辑: 为了读取大文件,我做了一些事情(我知道这是垃圾,但有时你根本无法更改 python 版本):

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

最佳答案

您正在寻找“大文件支持”。这里有一个不错的简介:http://docs.python.org/2/library/posix.html#large-file-support 。您可能需要使用适当的选项重新编译 Python 解释器,或者找到一个具有这些选项的预构建解释器。如果可以的话,尝试构建 Python 2.7。

关于Python 2.6 : Opening 4GB file throws "IOError: [Errno 127] Value too large to be stored in data type" on AIX,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21704904/

相关文章:

python - 如何使用 Python 在 Pandas 中应用多个条件?

python - osx -/usr/bin/python 和/System/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 有什么区别?

python - 调味包

在 Heroku 中使用 OpenCV 的 Python Web 应用程序

python - 有没有Python的 "magic constants"的综合表?

python - 跨行排名

Python 子进程抛出 [Errno 2] 没有这样的文件或目录,只有在远程主机上时才会产生错误

Python,单步执行文件夹(以运行脚本)

python - 在 Abaqus 6.12 中使用 matplotlib(适用于 python 2.6)