diff -r 587f64d9ecf2 Lib/idlelib/PyShell.py --- a/Lib/idlelib/PyShell.py Tue Mar 06 17:54:06 2012 +0100 +++ b/Lib/idlelib/PyShell.py Tue Mar 06 19:49:36 2012 +0100 @@ -1221,6 +1221,11 @@ self.set_line_and_column() def write(self, s, tags=()): + if isinstance(s, str) and max(s) > '\uffff': + # Tk doesn't support outputting non-BMP characters + char = max(s) + start = s.find(char) + raise UnicodeEncodeError("UCS-2", char, start, start+1, 'Non-BMP character not supported in Tk') try: self.text.mark_gravity("iomark", "right") OutputWindow.write(self, s, tags, "iomark")