[issue22742] IDLE shows traceback when printing non-BMP character

Martin Panter report at bugs.python.org
Wed Apr 24 20:55:41 EDT 2019


Martin Panter <vadmium+py at gmail.com> added the comment:

I haven’t looked at the code, but I suspect Idle implements a custom “sys.displayhook”:

>>> help(sys.displayhook)
Help on function displayhook in module idlelib.rpc:

displayhook(value)
    Override standard display hook to use non-locale encoding

>>> sys.displayhook('\N{ROCKET}')
'\U0001f680'
>>> sys.__displayhook__('\N{ROCKET}')
Traceback (most recent call last):
  File "<pyshell#20>", line 1, in <module>
    sys.__displayhook__('\N{ROCKET}')
  File "/usr/lib/python3.5/idlelib/PyShell.py", line 1344, in write
    return self.shell.write(s, self.tags)
UnicodeEncodeError: 'UCS-2' codec can't encode characters in position 1-1: Non-BMP character not supported in Tk

----------
nosy: +martin.panter

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue22742>
_______________________________________


More information about the Python-bugs-list mailing list