[issue2517] Error when printing an exception containing a Unicode string
Christoph Burgmer
report at bugs.python.org
Mon Mar 31 11:47:49 CEST 2008
Christoph Burgmer <cburgmer at ira.uka.de> added the comment:
To be more precise: I see no way to convert the encapsulated non-ASCII
data from the string in an easy way.
Taking e from my last post none of the following will work:
str(e) # UnicodeDecodeError
e.__str__() # UnicodeDecodeError
e.__unicode__() # AttributeError
unicode(e) # UnicodeDecodeError
unicode(e, 'utf8') # TypeError
My solution around this right now is raising an exception with an
already converted string (see the link I provided).
But as the tutorials speak of simply "print e" I guess the behaviour
described above is some kind of a bug.
__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue2517>
__________________________________
More information about the Python-bugs-list
mailing list