__unicode__ method for exception object
bignose+hates-spam at benfinney.id.au
Sun Jul 8 02:02:01 CEST 2007
Manlio Perillo <manlio_perilloNO at SPAMlibero.it> writes:
> I have just noticed that exception objects does not handle well
> Unicode arguments.
This error is unrelated to the fact that you created an exception
> >>> e = RuntimeError(u'àèìòù')
> >>> str(e)
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> UnicodeEncodeError: 'ascii' codec can't encode characters in position
Your terminal has been detected as using the 'ascii' encoding, so
while that's true no attempt to output non-ASCII characters will work.
You'll need to change whatever settings are on your terminal emulator
so that it is using an encoding (such as 'utf-8') which can display
the characters you want.
\ "The World is not dangerous because of those who do harm but |
`\ because of those who look at it without doing anything." -- |
_o__) Albert Einstein |
More information about the Python-list