【发布时间】:2010-11-07 15:39:15
【问题描述】:
处理 .xml 文件 = 1,45 Gb 时出现 MemoryError。我试图在一个较小的文件上运行它并且它可以工作,所以代码中不应该有任何错误。代码本身意味着打开一个 xml 文件,在里面做一些事情并将其保存回一个新的 txt 文件。我运行 Win7 x86、2 Gb RAM、Python 2.6
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
openfile('ukwiki-latest-pages-articles.xml')
File "C:\Users\Vof Freeman\Desktop\Python\test.py", line 7, in openfile
contents = F.read()
File "C:\Python26\lib\codecs.py", line 666, in read
return self.reader.read(size)
File "C:\Python26\lib\codecs.py", line 466, in read
newdata = self.stream.read()
MemoryError
【问题讨论】:
标签: python xml error-handling