etree import not working- Python 2.7.5
Question: I'm trying to use elementtree to parse xml but the import is giving me an
error.

**No module named etree**

I've tried :

    
    
    from xml.etree import ElementTree as ET
    
    import xml.etree.ElementTree as ET
    

I have elementtree downloaded in my python library on mac. Am I missing
something?

Thank you


Answer: [ElementTree is a part of the standard Python
library](https://docs.python.org/2/library/xml.etree.elementtree.html), you
shouldn't need to install anything to get it to work.

Using a [standard install from IdeOne, shows your first line works, with no
extra libraries](https://ideone.com/Ywik3H).

    
    
    from xml.etree import ElementTree as ET
    print ET
    

gives:

> Success time: 0.03 memory: 44896 signal:0
>  
>  
>     <module 'xml.etree.ElementTree' from '/usr/lib/pypy/lib-
> python/2.7/xml/etree/ElementTree.py'>
>  

Something has gone wrong with your install, or you are trying to use a [third
party library like lXML](http://lxml.de/tutorial.html).

* * *

Alternatively, [you have a file named
xml.py](http://stackoverflow.com/a/10324708/764357) in your project that is
overriding your Python install. You can check this by running the following
code in your file _before_ any other imports.

    
    
    import xml
    print xml.__file__
    

If the path doesn't look like this, and shows a path to your local project
thats your problem.

    
    
    /usr/lib/python2.7/xml/__init__.pyc
    

