0

I am trying to learn element tree so that i cna work with xml files a little more indepth. I have researched it and everythign i have read says that my version of python should have ElementTree already installed on it. But every time i try to run my sample script i get a error. I am running python 2.7.3 on unbuntu. If someone could help me fix this i would be greatly apriciated.

Traceback (most recent call last):
  File "/home/hatterx/Desktop/elementtree.py", line 1, in <module>
    from elementtree.ElementTree import Element
  File "/home/hatterx/Desktop/elementtree.py", line 1, in <module>
    from elementtree.ElementTree import Element
ImportError: No module named ElementTree
2
Contributors
1
Reply
31
Views
3 Years
Discussion Span
Last Post by snippsat
1

Import is.

>>> import xml.etree.ElementTree as ET
>>> ET.VERSION
'1.3.0'

And you should not name file elementtree.py,it shall not be in desktop folder.
This is a file in Pyhon library.

For me only Beautiful Soup or lxml for parsing.

Edited by snippsat

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.