error messages containing unicode

Jim jhefferon at smcvt.edu
Tue Jan 30 08:29:22 EST 2007


On Jan 30, 8:18 am, Peter Otten <__pete... at web.de> wrote:
> >>> try:...     raise Exception(u"gewöhnlich ähnlich üblich")
> ... except Exception, e:
> ...     print e.message
> ...
> gewöhnlich ähnlich üblich
Ah, so that's what "If there is a single argument (as is preferred), 
it is bound to the message attribute" means.  Through some imbecility 
I failed to understand it.  Thank you.

> If you're writing to a file you still have to encode explicitly.
Yes; I know that.  It wasn't what to do with the unicode object that 
confused me, it was how to get it in the first place.

Much obliged,
Jim




More information about the Python-list mailing list