Simple unicode-safe version of str(exception)?
"Martin v. Löwis"
martin at v.loewis.de
Mon Apr 28 18:34:11 EDT 2008
>> I have code like this:
>> except Exception, e:
>> self.setState(self.Failed, str(e))
>> which fails if the exception contains a unicode argument.
>
> Fails how?
ASCII encoding error, I suppose. It fails only if a) one argument
is a Unicode object, and b) that Unicode object contains non-ASCII
parameters.
>> I did, of course, try unicode(e) but that fails.
>
> Converting unicode to unicode doesn't help.
e is an exception object, not a Unicode object.
Regards,
Martin
More information about the Python-list
mailing list