Message217652
Observe:
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import xml.etree.ElementTree as ET
>>> root = ET.Element('root', attrib={'Name':'Root'})
>>> child = ET.SubElement(root, 'child', attrib={'Name':'Child'})
>>> ET.tostring(root)
'<root Name="Root"><child Name="Child" /></root>'
>>> import xml.etree.cElementTree as cET
>>> root = cET.Element('root', attrib={'Name':'Root'})
>>> child = cET.SubElement(root, 'child', attrib={'Name':'Child'})
>>> cET.tostring(root)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1126, in tostring
ElementTree(element).write(file, encoding, method=method)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 820, in write
serialize(write, self._root, encoding, qnames, namespaces)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 932, in _serialize_xml
v = _escape_attrib(v, encoding)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1092, in _escape_attrib
_raise_serialization_error(text)
File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1052, in _raise_serialization_error
"cannot serialize %r (type %s)" % (text, type(text).__name__)
TypeError: cannot serialize {'Name': 'Root'} (type dict) |
|
Date |
User |
Action |
Args |
2014-04-30 20:58:00 | santoso.wijaya | set | recipients:
+ santoso.wijaya |
2014-04-30 20:58:00 | santoso.wijaya | set | messageid: <1398891480.86.0.531348738543.issue21403@psf.upfronthosting.co.za> |
2014-04-30 20:58:00 | santoso.wijaya | link | issue21403 messages |
2014-04-30 20:58:00 | santoso.wijaya | create | |
|