Author vstinner
Recipients ezio.melotti, vstinner
Date 2009-01-30.15:46:49
SpamBayes Score 4.79887e-10
Marked as misclassified No
Message-id <1233330411.92.0.907757406611.issue5110@psf.upfronthosting.co.za>
In-reply-to
Content
You change change the display hook with a site.py script (which have 
to be in sys.path) :
---------
import sys

def hook(message):
    print(ascii(message))

sys.displayhook = hook
---------

Example (run python in an empty environment to get ASCII charset):
---------
$ env -i PYTHONPATH=$PWD ./python
Python 3.1a0 (py3k:69105M, Jan 30 2009, 10:36:27)
>>> import sys
>>> sys.stdout.encoding
'ANSI_X3.4-1968'
>>> "\xe9"
'\xe9'
>>> print("\xe9")
Traceback (most recent call last):
  (...)
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' (...)
---------
History
Date User Action Args
2009-01-30 15:46:52vstinnersetrecipients: + vstinner, ezio.melotti
2009-01-30 15:46:51vstinnersetmessageid: <1233330411.92.0.907757406611.issue5110@psf.upfronthosting.co.za>
2009-01-30 15:46:50vstinnerlinkissue5110 messages
2009-01-30 15:46:49vstinnercreate