__unicode__ method for exception object
Ben Finney
bignose+hates-spam at benfinney.id.au
Sat Jul 7 20:02:01 EDT 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
object.
> >>> 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 |
Ben Finney
More information about the Python-list
mailing list