[issue17915] Encoding error with sax and codecs

STINNER Victor report at bugs.python.org
Mon May 6 23:51:08 CEST 2013


STINNER Victor added the comment:

Extracted test from report.txt. Test with Python 3.4:

$ ./python test_codecs.py 
Traceback (most recent call last):
  File "test_codecs.py", line 7, in <module>
    xml.startDocument()
  File "/home/haypo/prog/python/default/Lib/xml/sax/saxutils.py", line 148, in startDocument
    self._encoding)
  File "/home/haypo/prog/python/default/Lib/codecs.py", line 699, in write
    return self.writer.write(data)
  File "/home/haypo/prog/python/default/Lib/codecs.py", line 355, in write
    data, consumed = self.encode(object, self.errors)
TypeError: Can't convert 'bytes' object to str implicitly

_gettextwriter() of xml.sax.saxutils does not recognize codecs classes. (See also the PEP 400 :-)).

----------
Added file: http://bugs.python.org/file30158/test_codecs.py

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


More information about the Python-bugs-list mailing list