[issue10974] IDLE 3.2 not loading on double-click in Finder, OSX 10.6

Ned Deily report at bugs.python.org
Sat Jan 22 08:50:04 CET 2011

Ned Deily <nad at acm.org> added the comment:

>From the traceback, IDLE is crashing on a decode error when trying to process the list of recently used files which is used to populate its recent files menu.  That list of files is saved in ~/.idlerc/recent-file.lst so an easy workaround is to delete the file before launching IDLE.app.  Most likely, the list of files contains at least one path name with a non-ASCII character.  IDLE appears to be dependent here on locale LANG settings.  When launched by double-clicking, like all Mac GUI apps IDLE.app does not inherited environment variables set in shell profiles, as in a terminal session.  The problem can be easily reproduced with bin/idle which is started from a shell environment:

$ echo $LANG
$ echo "/Users/nad/Documents/test_ä.py" > ~/.idlerc/recent-files.lst
$ /usr/local/bin/idle3.2
# with UTF-8 locale, idle starts normally with the umlauted file name in the recent files menu
$ unset LANG
$ /usr/local/bin/idle3.2
Traceback (most recent call last):
  File "/usr/local/bin/idle3.2", line 5, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/idlelib/PyShell.py", line 1388, in main
    shell = flist.open_shell()
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/idlelib/PyShell.py", line 277, in open_shell
    self.pyshell = PyShell(self)
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/idlelib/PyShell.py", line 813, in __init__
    OutputWindow.__init__(self, flist, None, None)
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/idlelib/OutputWindow.py", line 16, in __init__
    EditorWindow.__init__(self, *args)
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/idlelib/EditorWindow.py", line 267, in __init__
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/idlelib/EditorWindow.py", line 777, in update_recent_files_list
    rf_list = rf_list_file.readlines()
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/encodings/ascii.py", line 26, in decode
    return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 26: ordinal not in range(128)

A similar exception occurs (without a crash) when saving a file to a non-ASCII file name and LANG is not properly set:

Exception in Tkinter callback
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/tkinter/__init__.py", line 1399, in __call__
    return self.func(*args)
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/idlelib/MultiCall.py", line 166, in handler
    r = l[i](event)
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/idlelib/IOBinding.py", line 328, in save
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/idlelib/IOBinding.py", line 350, in save_as
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/idlelib/IOBinding.py", line 515, in updaterecentfileslist
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/idlelib/EditorWindow.py", line 795, in update_recent_files_list
UnicodeEncodeError: 'ascii' codec can't encode character '\xe4' in position 16: ordinal not in range(128)


Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list