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

SourceForge.net noreply at sourceforge.net
Tue Sep 2 23:16:08 EDT 2003


Bugs item #788378, was opened at 2003-08-13 23:49
Message generated for change (Comment added) made by loewis
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: Closed
>Resolution: Fixed
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: Martin v. Löwis (loewis)
Date: 2003-09-03 07:16

Message:
Logged In: YES 
user_id=21627

This is now fixed in IOBinding.py 1.21 and 1.19.8.2, NEWS

1.831.4.29.

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

Comment By: Andre Posumentov (aposumentov)
Date: 2003-08-14 13: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 06: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