classification
Title: error locale.getlocale() with LANGUAGE=eu_ES
Type: behavior Stage: test needed
Components: Library (Lib) Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: lemburg Nosy List: BreamoreBoy, lemburg, loewis, nkour, zunbeltz
Priority: normal Keywords:

Created on 2005-06-20 08:40 by zunbeltz, last changed 2010-08-26 17:24 by lemburg. This issue is now closed.

Messages (8)
msg60759 - (view) Author: Zunbeltz Izaola (zunbeltz) Date: 2005-06-20 08:40
I had sumited this bug (id 1177674) and it has been
closed becouse my bad explanation. 

My locale is set to LANGUAGE=eu_ES

This is what i get in the interpreter

Python 2.4.1 (#2, Mar 30 2005, 21:51:10)
[GCC 3.3.5 (Debian 1:3.3.5-8ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for
more information.

>>> import locale
>>> locale.getlocale()
(None, None)
>>> locale.setlocale(locale.LC_ALL, '')
'eu_ES'
>>>
>>> locale.getlocale()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/locale.py", line 365, in
getlocale
    return _parse_localename(localename)
  File "/usr/lib/python2.4/locale.py", line 278, in
_parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: eu_ES
>>>
msg60760 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2005-07-06 05:28
Logged In: YES 
user_id=21627

What do you need locale.getlocale() for? If it is to
determine the encoding, I recommend to use
locale.getpreferredencoding() instead.
msg60761 - (view) Author: Nikos Kouremenos (nkour) Date: 2005-11-13 21:30
Logged In: YES 
user_id=865368

this bug is REAL and major IMO

any app that uses localization cannot be runned by a basque

python is not aware of eu_ES at all!

I don't know if this solves it (I'm not basque)

--- /usr/lib/python2.4/locale.py        2005-11-12
11:59:16.000000000 +0200
+++ /tmp/locale.py      2005-11-13 23:27:27.000000000 +0200
@@ -481,6 +481,7 @@
         'ar_aa':                         'ar_AA.ISO8859-6',
         'ar_sa':                         'ar_SA.ISO8859-6',
         'arabic':                        'ar_AA.ISO8859-6',
+        'basque':                        'eu_ES.ISO8859-1',
         'bg':                            'bg_BG.ISO8859-5',
         'bg_bg':                         'bg_BG.ISO8859-5',
         'bulgarian':                     'bg_BG.ISO8859-5',
@@ -540,6 +541,7 @@
         'es_ve':                         'es_VE.ISO8859-1',
         'et':                            'et_EE.ISO8859-4',
         'et_ee':                         'et_EE.ISO8859-4',
+        'eu_ES':                         'eu_ES.ISO8859-1',
         'fi':                            'fi_FI.ISO8859-1',
         'fi_fi':                         'fi_FI.ISO8859-1',
         'finnish':                       'fi_FI.ISO8859-1',


btw for this not to happen again (sad to see py242 not
fixing this) http://www.mpi-sb.mpg.de/~pesca/locales.html

Zunbeltz Izaola is a courageous man, and please loweis think
a bit more before replying why do you need that and this
msg60762 - (view) Author: Martin v. Löwis (loewis) * (Python committer) Date: 2005-11-13 22:36
Logged In: YES 
user_id=21627

It was a candid question: why do you need getlocale()? This
function is inherently broken, not just for basque, and
there is no way to fix it for good. So it would be best to
remove the function entirely.

Before such a step can be taken, I need to know why people
use it in the first place.
msg60763 - (view) Author: Nikos Kouremenos (nkour) Date: 2005-11-13 22:43
Logged In: YES 
user_id=865368

python itself uses this func,

I don't even ask getlocale()!

I just do:

time.strptime(tim, '%Y%m%dT%H:%M:%S')

somewhere and enjoy:

time.strptime(tim, '%Y%m%dT%H:%M:%S')
  File "/usr/lib/python2.4/_strptime.py", line 269, in ?
    _TimeRE_cache = TimeRE()
  File "/usr/lib/python2.4/_strptime.py", line 188, in __init__
    self.locale_time = LocaleTime()
  File "/usr/lib/python2.4/_strptime.py", line 73, in __init__
    self.lang = _getlang()
  File "/usr/lib/python2.4/_strptime.py", line 32, in _getlang
    return locale.getlocale(locale.LC_TIME)
  File "/usr/lib/python2.4/locale.py", line 363, in getlocale
    return _parse_localename(localename)
  File "/usr/lib/python2.4/locale.py", line 278, in
_parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: eu_ES

so basque feels like he's ATIA here
msg60764 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2005-11-13 23:23
Logged In: YES 
user_id=38388

Not so fast, Martin. I know that you don't like the
function, but there's no reason to remove it.

Note that this bug is fixed in CVS: 

I updated the locale database with the most recent X.org
data last December. It does include the eu_es mapping, but
doesn't have the basque mapping.
msg114996 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2010-08-26 16:09
From msg60764 "Note that this bug is fixed in CVS:".  I'd test myself, but the last time I tried soemthing like this it took me ages to persuade Windows Calendar that I wasn't Dutch.
msg115010 - (view) Author: Marc-Andre Lemburg (lemburg) * (Python committer) Date: 2010-08-26 17:24
Closing the report: eu_es has been Python for quite a while (at least since Python 2.5).

If you also feel that 'basque' should be added as alias, please provide proof that this alias is really in use and open a new bug report.
History
Date User Action Args
2010-08-26 17:24:36lemburgsetstatus: open -> closed
assignee: lemburg
resolution: fixed
messages: + msg115010
2010-08-26 16:09:51BreamoreBoysetversions: + Python 3.1, Python 2.7, Python 3.2, - Python 2.6, Python 3.0
nosy: + BreamoreBoy

messages: + msg114996

components: + Library (Lib), - None
2009-03-20 21:50:43ajaksu2setstage: test needed
type: behavior
versions: + Python 2.6, Python 3.0
2005-06-20 08:40:04zunbeltzcreate