[ python-Bugs-504219 ] locale.resetlocale is broken

SourceForge.net noreply at sourceforge.net
Wed Sep 14 00:27:40 CEST 2005


Bugs item #504219, was opened at 2002-01-15 20:56
Message generated for change (Comment added) made by meonkeys
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=504219&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Library
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Submitted By: Syver Enstad (syvere)
Assigned to: Mark Hammond (mhammond)
Summary: locale.resetlocale is broken

Initial Comment:
locale.setlocale doesn't recognize the the format that 
locale.py uses to set the locale, ie. no_NO and 
friends.

The only way I've succeeded in setting the locale on 
Python 2.1 is to use the format described in the 
Visual C++ C-runtime library docs for setlocale where 
a more verbose format is used to set the locale.

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

Comment By: Adam Monsen (meonkeys)
Date: 2005-09-13 15:27

Message:
Logged In: YES 
user_id=259388

I'm seeing this error on Fedora Core 4:

Python 2.4.1 (#1, May 16 2005, 15:19:29) 
[GCC 4.0.0 20050512 (Red Hat 4.0.0-5)] on linux2
Type "help", "copyright", "credits" or "license" for more
information.
>>> import locale; locale.getdefaultlocale()
('en_US', 'utf')
>>> locale.resetlocale()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/locale.py", line 389, in resetlocale
    _setlocale(category, _build_localename(getdefaultlocale()))
locale.Error: unsupported locale setting

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

Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-06-05 11:04

Message:
Logged In: YES 
user_id=1188172

As this is not Windows specific, setting Category to Library.

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

Comment By: Johannes Gijsbers (jlgijsbers)
Date: 2004-11-08 10:59

Message:
Logged In: YES 
user_id=469548

Still reproducible with Python 2.4:

Python 2.4b2 (#19, Nov  8 2004, 11:15:07)
[GCC 3.3.5 (Debian 1:3.3.5-2)] on linux2
Type "help", "copyright", "credits" or "license" for more
information.
>>> import locale
>>> locale.getdefaultlocale()
['en_US', 'utf']
>>> locale.resetlocale()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/home/johannes/python/Lib/locale.py", line 389, in
resetlocale
    _setlocale(category, _build_localename(getdefaultlocale()))
locale.Error: unsupported locale setting

Note that if I run python with 'LANG=nl_NL python', the
error does not occur.

http://python.org/sf/813449 seems to be the same bug, BTW.

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

Comment By: Syver Enstad (syvere)
Date: 2002-01-16 05:39

Message:
Logged In: YES 
user_id=428736

Sorry, I forgot to mention the testcase I am using. The 
test case that fails is the locale module itself, when 
running it as a standalone application that is.

To be more specific:
  File &quot;d:\devtools\python21\lib\locale.py&quot;, line 384, in 
resetlocale
    _setlocale(category, _build_localename(getdefaultlocale
()))
locale.Error: locale setting not supported

And to clarify what input getdefaultlocale returns on my 
machine:

&gt;&gt;&gt; locale.getdefaultlocale()
('no_NO', 'cp1252')

and:
&gt;&gt;&gt; locale._build_localename(locale.getdefaultlocale())
'no_NO.cp1252'

By the way, is this bug fixed in python 2.2?


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

Comment By: Martin v. Löwis (loewis)
Date: 2002-01-16 03:50

Message:
Logged In: YES 
user_id=21627

Can you provide a detailed test case? AFAIK, no_NO is indeed
no supported locale name on Windows, and I don't think
Python aanywhere uses it without the application explicitly
saying so.

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

Comment By: Tim Peters (tim_one)
Date: 2002-01-15 21:07

Message:
Logged In: YES 
user_id=31435

Mark, know anything about this?  I don't.

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

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


More information about the Python-bugs-list mailing list