This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Frank
Recipients Frank
Date 2013-01-10.05:20:08
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1357795209.81.0.959594987478.issue16913@psf.upfronthosting.co.za>
In-reply-to
Content
Since upgrading to python 3.3 the tostring method fails when the output method is requested as text. Code like this:

with open(fp, mode='rt') as f:
    data = f.read()
tree, idmap = ET.XMLID(data)
print(ET.tostring(tree, method='text', encoding='unicode'))

Generates the following error:

Traceback (most recent call last):
  File "/home/john/Desktop/docs/Pear/pear.py", line 64, in pass_four
    print(ET.tostring(tree, method='text', encoding='unicode'))
  File "/usr/lib/python3.3/xml/etree/ElementTree.py", line 1171, in tostring
    ElementTree(element).write(stream, encoding, method=method)
  File "/usr/lib/python3.3/xml/etree/ElementTree.py", line 824, in write
    _serialize_text(write, self._root)
  File "/usr/lib/python3.3/xml/etree/ElementTree.py", line 1057, in _serialize_text
    write(part)
TypeError: string argument expected, got 'list'

Whereas it used to return plain text with formatting tags stripped from the root element on prior versions of python.
History
Date User Action Args
2013-01-10 05:20:09Franksetrecipients: + Frank
2013-01-10 05:20:09Franksetmessageid: <1357795209.81.0.959594987478.issue16913@psf.upfronthosting.co.za>
2013-01-10 05:20:09Franklinkissue16913 messages
2013-01-10 05:20:08Frankcreate