[Twisted-Python] Unicode exceptions

Temchenko Grigory soid-exe at yandex.ru
Thu Mar 17 09:37:04 EDT 2011


Hey there,

On my production server I have periodically happening unicode error but not on my desktop. It appears in logs:

2011-03-17 13:14:53+0000 [GameProtocol,941,95.78.43.17] <unicode instance at 0x9e304a0 with str error:
	 Traceback (most recent call last):
	  File "/usr/local/lib/python2.6/dist-packages/twisted/python/reflect.py", line 546, in _safeFormat
	    return formatter(o)
	UnicodeEncodeError: 'ascii' codec can't encode characters in position 21-26: ordinal not in range(128)
	>

It doesn't affect any logic in application but it's annoying in logs.

The server runs under Ubuntu 10.10 Server, Python 2.6.5, Twisted 10.2.0.
The desktop is Ubuntu 10.10 Desktop, Python 2.6.5, Twisted 10.2.0.

Locales are the same:
$ locale
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=en_US.UTF-8

What do I have to check to get it fixed?



More information about the Twisted-Python mailing list