Module locale throws exception: unsupported locale setting

Ned Deily nad at acm.org
Fri Nov 19 15:27:49 EST 2010


In article <ic6ksr$n0k$03$1 at news.t-online.com>,
 Sibylle Koczian <nulla.epistola at web.de> wrote:
> on a german Windows installation I get problems with locale. If I run 
> that module as a script from a command window this is the output:
> 
> C:\Python31\Lib>locale.py
> Locale aliasing:
> 
> Locale defaults as determined by getdefaultlocale():
> ------------------------------------------------------------------------
> Language:  de_DE
> Encoding:  cp1252
> 
> Locale settings on startup:
> ------------------------------------------------------------------------
> LC_NUMERIC ...
>     Language:  (undefined)
>     Encoding:  (undefined)
> 
> LC_MONETARY ...
>     Language:  (undefined)
>     Encoding:  (undefined)
> 
> LC_COLLATE ...
>     Language:  (undefined)
>     Encoding:  (undefined)
> 
> LC_CTYPE ...
>     Language:  (undefined)
>     Encoding:  (undefined)
> 
> LC_TIME ...
>     Language:  (undefined)
>     Encoding:  (undefined)
> 
> 
> Locale settings after calling resetlocale():
> ------------------------------------------------------------------------
> Traceback (most recent call last):
>    File "C:\Python31\Lib\locale.py", line 1798, in <module>
>      _print_locale()
>    File "C:\Python31\Lib\locale.py", line 1761, in _print_locale
>      resetlocale()
>    File "C:\Python31\Lib\locale.py", line 537, in resetlocale
>      _setlocale(category, _build_localename(getdefaultlocale()))
> locale.Error: unsupported locale setting
> 
> C:\Python31\Lib>
> 
> This is Windows 7, 64 bit, Python 3.1.2. Same behavior on another 
> Windows machine with Python 2.7 (Windows XP, 32 bit).
> 
> On Linux, using UTF-8 as system character set and Python 2.6, 2.6.5 or 
> 3.1.2, no problems using locale, running the module as a script gives no 
> exception but the expected output. So I suppose it's either an OS 
> problem or connected with the encoding.
> 
> I've looked into bugs.python.org, but found only vaguely similar issues. 
> Should I open a new one?

There have been a lot of changes going into Python 3.2, currently in 
alpha testing, in the areas of encodings and how they affect the 
interfaces to/from the various platform operating systems Python 3 runs 
on.  It would be very useful if you could try the same test with the 
most recent Python 3.2 alpha 
(http://www.python.org/download/releases/3.2/) and, if the problem 
persists there, open an issue about it.

-- 
 Ned Deily,
 nad at acm.org




More information about the Python-list mailing list