I'm getting an error from the following code:
import xml.etree.ElementTree as ET
tree = ET.ElementTree()
root = ET.Element("configuration")
elem = ET.SubElement(root, "appConfig")
elem2 = ET.SubElement(root, "fileGDB")
print ET.tostring(root)
tree.write(sys.stdout)
It throws an exception on the following line in the ElementTree.py module: iterate = elem.getiterator # cET compatibility The exception is: AttributeError: 'NoneType' object has no attribute 'getiterator'
In the code above:
print ET.tostring(root)
prints out just fine. I don't understand why it's throwing this exception. What am I doing wrong?
Steve