diff -r 0d8f0526813f Lib/idlelib/PyShell.py --- a/Lib/idlelib/PyShell.py Sun Nov 03 23:25:42 2013 +0200 +++ b/Lib/idlelib/PyShell.py Mon Nov 04 10:40:12 2013 +0200 @@ -1338,8 +1338,13 @@ def write(self, s): if self.closed: raise ValueError("write to closed file") - if not isinstance(s, (basestring, bytearray)): - raise TypeError('must be string, not ' + type(s).__name__) + if type(s) not in (str, unicode, bytearray): + if isinstance(s, unicode): + s = unicode(s) + elif isinstance(s, (str, bytearray)): + s = str(s) + else: + raise TypeError('must be string, not ' + type(s).__name__) return self.shell.write(s, self.tags)