[issue15811] ElementTree.write() raises TypeError when xml_declaration = True and encoding is a unicode string

Amaury Forgeot d'Arc report at bugs.python.org
Wed Aug 29 18:45:16 CEST 2012


Amaury Forgeot d'Arc added the comment:

Why is it a problem? Encoding must be a text string:
  encoding='utf-8'
works with both Python 2 and 3.

Or if you used "from __future__ import unicode_literals",
    str('utf-8')
works as well.

----------
nosy: +amaury.forgeotdarc

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15811>
_______________________________________


More information about the Python-bugs-list mailing list