Python 2.7.5: Strange and differing behavior depending on sys.setdefaultencoding being set

Hans-Peter Jansen hpj at urpla.net
Tue Dec 3 23:32:25 CET 2013


Hi,

I'm experiencing strange behavior with attached code, that differs depending 
on sys.setdefaultencoding being set or not. If it is set, the code works as 
expected, if not - what should be the usual case - the code fails with some 
non-sensible traceback.

I tried to boil it down to a comprehensible state, but some LOC are still 
involved. I use similar code to represent database records, where the repr's 
appear in user visible logs for example.

It is greatly appreciated, if some kind soul could shed some light on this 
ungrateful behavior.

Thanks in advance,
Pete
-------------- next part --------------
A non-text attachment was scrubbed...
Name: reprtest.py
Type: text/x-python
Size: 4894 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20131203/90757f96/attachment.py>


More information about the Python-list mailing list