Python shell wont open idle or an exisiting py file

Terry Reedy tjreedy at
Sat Feb 1 02:45:49 CET 2014

On 1/31/2014 2:51 PM, Peter Otten wrote:
> rpucci2 at wrote:
>> Python 3.3.3 (v3.3.3:c3896275c0f6, Nov 18 2013, 21:18:40) [MSC v.1600 32
>> bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more
>> information.
>>>>> import idlelib.idle
>> Exception in Tkinter callback
>> Traceback (most recent call last):
>>    File "C:\Python33\lib\tkinter\", line 1475, in __call__
>>      return self.func(*args)
>>    File "C:\Python33\lib\idlelib\", line 927, in
>>    open_recent_file
>>    File "C:\Python33\lib\idlelib\", line 183, in open
>>    File "C:\Python33\lib\idlelib\", line 36, in open
>>      edit = self.EditorWindow(self, filename, key)
>>    File "C:\Python33\lib\idlelib\", line 126, in __init__
>>      EditorWindow.__init__(self, *args)
>>    File "C:\Python33\lib\idlelib\", line 287, in __init__
>>      if io.loadfile(filename):
>>    File "C:\Python33\lib\idlelib\", line 242, in loadfile
>>      self.updaterecentfileslist(filename)
>>    File "C:\Python33\lib\idlelib\", line 523, in
>>    updaterecentfileslist
>>      self.editwin.update_recent_files_list(filename)
>>    File "C:\Python33\lib\idlelib\", line 915, in
>>    update_recent_files_list
>>      menu.delete(0, END)  # clear, and rebuild:
>>    File "C:\Python33\lib\tkinter\", line 2778, in delete
>>      if 'command' in self.entryconfig(i):
>>    File "C:\Python33\lib\tkinter\", line 2788, in entryconfigure
>>      return self._configure(('entryconfigure', index), cnf, kw)
>>    File "C:\Python33\lib\tkinter\", line 1247, in _configure
>>, cmd)))):
>> UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc0 in position 10:
>> invalid start byte
>> This is the error message.

> What happens if you rename
> $HOME/.idlerc/recent-files.lst

For me, on Win7, $HOME is C:/Users/Terry

> (to an arbitrary name, just to keep it around for further debugging if the
> file indeed triggers the problem)?

Or try the following in the console with the file name changed, but 
without the first line wrapped

with open('C:/Users/Terry/.idlerc/recent-files.lst', encoding='utf-8') as f:
      for n, line in enumerate(f):
           print(n, line, end='')

There was a (non-obvious) bug, recently fixed in
which caused this seemingly bogus error message when an entry in 
recent-files.list contained a directory or file name beginning with '0'.

caused this message
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc0 in position 14: 
invalid start byte

If your file has such a line, either delete it or upgrade to 3.3.4 (rc1, 
final soon) or 3.4.0 (rc1 due soon).

Terry Jan Reedy

More information about the Python-list mailing list