Your SubElement call is lacking the attrib argument, but you can't set text, anyway.
The elementtree source makes it clear, you can only set element attrib attributes with SubElement def SubElement(parent, tag, attrib={}, **extra): attrib = attrib.copy() attrib.update(extra) element = parent.makeelement(tag, attrib) parent.append(element) return element -- http://mail.python.org/mailman/listinfo/python-list