Ned Deily <[email protected]> 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
en_US.UTF-8
$ 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>
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)
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue10974>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com