[Tutor] Parse XML file

Lukas Agrapidis lagrapidis at yahoo.com
Sat Mar 14 23:30:35 CET 2009

I am trying to parse an XML file using Python and found this resource 

But I didn't even get past the second line... it does not see the xml file?  But it is there. 

>>> from xml.dom import minidom   >>> xmldoc = minidom.parse('~/Desktop/test/test.xml')

Traceback (most recent call last):
  File "<pyshell#7>", line 1, in <module>
    xmldoc = minidom.parse('~/Desktop/test/test.xml')
  File "C:\Program Files\python26\lib\xml\dom\minidom.py", line 1918, in parse
    return expatbuilder.parse(file)
  File "C:\Program Files\python26\lib\xml\dom\expatbuilder.py", line 922, in parse
    fp = open(file, 'rb')
IOError: [Errno 2] No such file or directory: '~/Desktop/test/test.xml'


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090314/a0d99d4d/attachment.htm>

More information about the Tutor mailing list