Exceptions and unicode messages

kyosohma at gmail.com kyosohma at gmail.com
Wed Mar 21 09:16:10 EDT 2007


On Mar 21, 6:03 am, Tuomas <tuomas.vesteri... at pp.inet.fi> wrote:
> This works:
>  >>> raise StandardError(u'Wrong type')
> Traceback (most recent call last):
>    File "<stdin>", line 1, in ?
> StandardError: Wrong type
>
> but don't in Finnish:
>  >>> raise StandardError(u'Väärä tyyppi')
> Traceback (most recent call last):
>    File "<stdin>", line 1, in ?
> StandardError>>>
>  >>>
>
> Any solution in Python?
>
> TV

When I do this, mine says "StandardError: <unprintable StandardError
object>" on both Python 2.4 and 2.5. I tried setting them to unicode,
but that didn't help. One way around this may be to subclass the
errors you want and do some custom processing that way.

Mike




More information about the Python-list mailing list