[IPython-user] problem with unicode and the compile function in ipython

Robert Kern robert.kern@gmail....
Wed Dec 12 15:06:00 CST 2007

Ville M. Vainio wrote:
> On Nov 29, 2007 6:56 AM, pan <nirvana117@gmail.com> wrote:
>> And because python2.3 lacks sys.setappdefaultencoding, so have to
>> reload(sys), and use sys.setdefaultencoding.
>> The patch for svn-2875:
>>  Index: IPython/iplib.py
>> +# make converting between str and unicode easy
>>  +try:
>> +    sys.setappdefaultencoding(sys.stdin.encoding or 'ascii')
>>  +except:
>> +    # python2.3 does not have sys.setappdefaultencoding
>> +    reload(sys)
>> +    sys.setdefaultencoding(sys.stdin.encoding or 'ascii')
> I have now applied your patch, but I think we should remove such calls
> to 'str', making IPython unicode clean for the most parts. That should
> not be an overwhelming task...

sys.setdefaultencoding() should not be used under any circumstances.
sys.setappdefaultencoding() is not in any standard Python distribution. It
appears that the IDE Eric installs this as an alias to sys.setdefaultencoding()
in sitecustomize.py:


Please, revert this change.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

More information about the IPython-user mailing list