This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ned.deily
Recipients naguilera, ned.deily
Date 2011-01-22.07:45:38
SpamBayes Score 1.31368e-11
Marked as misclassified No
Message-id <1295682342.15.0.426740191888.issue10974@psf.upfronthosting.co.za>
In-reply-to
Content
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.  IDLE appears to be dependent 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
en_US.UTF-8
$ echo "/Users/nad/Documents/test_ä.py" > ~/.idlerc/recent-files.lst
nad@fimt:~$ /usr/local/bin/idle3.2
# 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>
    main()
  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__
    self.update_recent_files_list()
  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
    self.save_as(event)
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/idlelib/IOBinding.py", line 350, in save_as
    self.updaterecentfileslist(filename)
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/idlelib/IOBinding.py", line 515, in updaterecentfileslist
    self.editwin.update_recent_files_list(filename)
  File "/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/idlelib/EditorWindow.py", line 795, in update_recent_files_list
    rf_file.writelines(rf_list)
UnicodeEncodeError: 'ascii' codec can't encode character '\xe4' in position 16: ordinal not in range(128)
History
Date User Action Args
2011-01-22 07:50:11ned.deilyunlinkissue10974 messages
2011-01-22 07:45:42ned.deilysetrecipients: + ned.deily, naguilera
2011-01-22 07:45:42ned.deilysetmessageid: <1295682342.15.0.426740191888.issue10974@psf.upfronthosting.co.za>
2011-01-22 07:45:39ned.deilylinkissue10974 messages
2011-01-22 07:45:38ned.deilycreate