Bug: (Locale) IDLE/Tkinter/Python?

Guido van Rossum guido at CNRI.Reston.VA.US
Wed Oct 6 14:05:29 EDT 1999


> I'm not sure how well Python copes with this generally, but
> changing my locale so that the thousands sep and decimals sep
> (normally ',' , '.') are reversed ('.' , ',') causes a problem
> in Tkinter, and therfore IDLE.
> 
> But, for some reason, only in embedded code, not Python run from
> the commandline. Perhaps by default it ignores locale info.
> 
> Traceback (innermost last):
>   File "C:\Progra~1\Python\Tools\idle\idle.py", line 2, in ?
>     import PyShell
>   File "C:\Progra~1\Python\Tools\idle\PyShell.py", line 12, in ?
>     from Tkinter import *
>   File "C:\Progra~1\Python\Lib\lib-tk\Tkinter.py", line 19, in ?
>     TkVersion = _string.atof(_tkinter.TK_VERSION)
> ValueError: invalid literal for atof(): 8.0
> 
> Any suggestions?

Hm, that's odd.  Python is supposed to ignore the locale when you use
atof(); the locale module exports a version of atof() that honors the
locale after you call locale.setlocale(locale.LC_ALL, "").

What platform are you on?  It seems that perhaps the Tcl version you
are using calls setlocale() on that platform?

I cannot reproduce this (on Solaris 2.7).

--Guido van Rossum (home page: http://www.python.org/~guido/)




More information about the Python-list mailing list