finding and Importing xml file into python
Question: I am attempting to import an xml file into python with minidom.

    
    
    >>> from xml.dom import minidom
    >>> import os
    >>> xmldoc = minidom.parse('c/Users/WFD/Documents/VXWorks/XML_Parasing_Python')
    

and python cannot find this file even though I have specifically spelled out
where it is. I am new to python so if there is a glaring error I apologize but
can anyone explain how to import an xml file in mydocments? Here is the error:

    
    
    Traceback (most recent call last):
      File "<pyshell#3>", line 1, in <module>
        xmldoc = minidom.parse('c/Users/WFD/Documents/VXWorks/XML_Parasing_Python')
      File "C:\Python27\lib\xml\dom\minidom.py", line 1920, in parse
        return expatbuilder.parse(file)
      File "C:\Python27\lib\xml\dom\expatbuilder.py", line 922, in parse
        fp = open(file, 'rb')
    IOError: [Errno 2] No such file or directory: 'c/Users/WFD/Documents/VXWorks/XML_Parasing_Python'
    

Thanks!


Answer: It looks as if the path you are giving is not correct: for Windows, the proper
way to format an absolute file path is:

    
    
    blah("C:/Users/WFD/Documents/VXWorks/XML_Parasing_Python")
    

Also, `XML_Parasing_Python` may be mispelled; it probably should be
`XML_Parsing_Python`.

You can use the [`os.path`
module](http://docs.python.org/2/library/os.path.html#os.path.expanduser) for
more cross-platform scripts.

