idle 2.x and unicode literals

Joe P. Cool at
Fri Apr 2 05:02:24 EDT 2010


I'm working with Python 2.6.4 on Ubuntu 9.10 and noticed a difference
between IDLE and command line python. If I enter an é  (accented e,
LATIN SMALL LETTER E WITH ACUTE) as a unicode string in command line
python I get this:

>>> u'é'

In IDLE 2.6.4 I get this:

>>> u'é'

IDLE is set to UTF-8 and console environment has LANG = en_US.UTF-8.
This is a bit annyoing because ord(u'é') works on the command line but
raises an exception in IDLE:

>>> ord(u'é')
Traceback (most recent call last):
  File "<pyshell#7>", line 1, in <module>
TypeError: ord() expected a character, but string of length 2 found

Is this a bug? IDLE 3.1.1 works.


More information about the Python-list mailing list