[Python-bugs-list] [ python-Bugs-788378 ] Unsupported 'locale' setting causes Idle to crash on startup

SourceForge.net noreply at sourceforge.net
Thu Aug 14 05:48:16 EDT 2003


Bugs item #788378, was opened at 2003-08-13 21:49
Message generated for change (Comment added) made by aposumentov
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=788378&group_id=5470

Category: IDLE
Group: Python 2.3
Status: Open
Resolution: Accepted
Priority: 5
Submitted By: Andre Posumentov (aposumentov)
Assigned to: Martin v. Löwis (loewis)
Summary: Unsupported 'locale' setting causes Idle to crash on startup

Initial Comment:
If the 'LANG' environment variable is set to an 
unsupported value, Idle crashes on startup.

The error occurs in IOBinding.py, as follows:

Traceback (most recent call last):
  File "Resources/__argvemulator_idle", line 4, in ?
    execfile(os.path.join(os.path.split(__file__)[0], 
"idle"))
  File "Resources/idle", line 4, in ?
    import idlelib.PyShell
  File "/Applications/MacPython-2.3/IDLE.app/
Contents/Resources/idlelib/PyShell.py", line 22, in ?
    from EditorWindow import EditorWindow, 
fixwordbreaks
  File "/Applications/MacPython-2.3/IDLE.app/
Contents/Resources/idlelib/EditorWindow.py", line 39, 
in ?
    class EditorWindow:
  File "/Applications/MacPython-2.3/IDLE.app/
Contents/Resources/idlelib/EditorWindow.py", line 43, 
in EditorWindow
    from IOBinding import IOBinding
  File "/Applications/MacPython-2.3/IDLE.app/
Contents/Resources/idlelib/IOBinding.py", line 31, in ?
    locale.setlocale(locale.LC_CTYPE, "")
  File "/Library/Frameworks/Python.framework/
Versions/2.3/lib/python2.3/locale.py", line 381, in 
setlocale
    return _setlocale(category, locale)
locale.Error: locale setting not supported


Here are the offending lines in IOBinding.py:

try:
    import locale
    locale.setlocale(locale.LC_CTYPE, "")
except ImportError:
    pass

As it's not an 'ImportError'...

The error is reproducible on Mac OS X 10.2.6, running  
MacPython-2.3.  I have not been able to test on other   
operating systems.


----------------------------------------------------------------------

>Comment By: Andre Posumentov (aposumentov)
Date: 2003-08-14 11:48

Message:
Logged In: YES 
user_id=677286


>> except (ImportError, locale.Error):

I've tested the change on my system, and it looks good.  
No crashing on startup, and everything else seems to 
function as it should.



----------------------------------------------------------------------

Comment By: Kurt B. Kaiser (kbk)
Date: 2003-08-14 04:49

Message:
Logged In: YES 
user_id=149084

I suppose the right thing to do here is

except (ImportError, locale.Error):

Is that correct?
I'm going to be away for a few days....

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=788378&group_id=5470



More information about the Python-bugs-list mailing list