1

Am trying to read an xml file(which is a french diccionary) from a python script, but am getting the error below. Is there anyway I can fix it? PS: the file is 158 643 Ko

from xml.dom import minidom
doc = minidom.parse("Dic.xml")

Data = doc.getElementsByTagName("title")[0]
titleData = Data.firstChild.data
print (titleData)

The error:

Traceback (most recent call last):
  File "<pyshell#3>", line 1, in <module>
    doc = minidom.parse("Morphalou-2.0.xml")
  File "C:\Python27\lib\xml\dom\minidom.py", line 1918, in parse
    return expatbuilder.parse(file)
  File "C:\Python27\lib\xml\dom\expatbuilder.py", line 924, in parse
    result = builder.parseFile(fp)
  File "C:\Python27\lib\xml\dom\expatbuilder.py", line 204, in parseFile
    buffer = file.read(16*1024)
MemoryError

Advance Thanks

Ran
  • 635
  • 2
  • 10
  • 22

0 Answers0