我正在尝试将.mat文件加载到相当大的python(> 75MB)中,并且我收到以下错误。这有帮助吗?
Traceback (most recent call last):
File "prop_keys.py", line 34, in <module>
prop_d = scipy.io.loadmat(prop)
File "/usr/lib/python2.7/dist-packages/scipy/io/matlab/mio.py", line 175, in loadmat
matfile_dict = MR.get_variables(variable_names)
File "/usr/lib/python2.7/dist-packages/scipy/io/matlab/mio5.py", line 272, in get_variables
hdr, next_position = self.read_var_header()
File "/usr/lib/python2.7/dist-packages/scipy/io/matlab/mio5.py", line 224, in read_var_header
stream = BytesIO(dcor.decompress(data))
SystemError: ../Objects/stringobject.c:3899: bad argument to internal function
答案 0 :(得分:0)
如上所述:http://projects.scipy.org/scipy/ticket/1894
该文件包含压缩数据,在未压缩时最高可达1.1GB。 错误消息是您的计算机没有足够的可用内存来存储此数据的症状。除此之外,文件的后半部分似乎也已损坏,Matlab也无法正确加载。
(如果数据被压缩,Scipy的mat文件加载例程实际上需要2x内存;但是,这将在Scipy 0.13.0中修复。)