[issue29809] TypeError in traceback.print_exc - unicode does not have the buffer interface

Jason R. Coombs report at bugs.python.org
Tue Mar 14 18:35:11 EDT 2017


Jason R. Coombs added the comment:

As a workaround, I wrapped BytesIO thus and it works for our needs.

class LenientIO(io.BytesIO):
    """
    A version of BytesIO that can accept unicode or
    bytes. See http://bugs.python.org/issue29809
    """
    def write(self, value):
        if isinstance(value, six.text_type):
            value = value.encode('utf-8')
        super(LenientIO, self).write(value)


I'll recommend we close as wontfix, given the limited impact, unless it's demonstrated elsewhere.

----------

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


More information about the Python-bugs-list mailing list