指针处的exceptions.MemoryError实例

时间:2012-07-17 20:09:49

标签: python garbage-collection

我在服务器上使用python 2.4.3,当我尝试运行此代码时,在我的计算机上使用python 2.7.3正常工作:

import sys
import array
import os
import glob

nx = 360
ny = 120
km = 30
ibio = 11  
iday = 365

latcoord = 56  
longcoord = 248


filenames = '/path/to/myfile'

f = open(filenames, 'rb')
lbl = array.array('f')
bio = 0
for day in range(iday):
    f.seek(nx*ny*km*bio*4, 1)
    for depth in range(km):
            f.seek(((latcoord-1)*nx+longcoord)*4, 1)
            lbl.read(f, 1)
            f.seek(((ny-latcoord)*nx+(nx-longcoord)*4, 1)
    f.seek(nx*ny*km*(10-bio)*4, 1)

f.close()
print lbl

我收到此错误:

array('f', <NULL>)
Exception exceptions.MemoryError: <exceptions.MemoryError instance at 0x2abf7a126098> in 'garbage collection' ignored
Fatal Python error: unexpected exception during garbage collection
Abort

shell returned 134

关于我如何解决这个问题的任何想法?我没有权限升级python。

0 个答案:

没有答案