Patches item #1118341, was opened at 2005-02-08 04:39
Message generated for change (Comment added) made by nerijus
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1118341&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: Library (Lib)
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Nerijus Baliunas (nerijus)
Assigned to: Nobody/Anonymous (nobody)
Summary: unknown locale: lt_LT (patch)

Initial Comment:
When running wxPython app I get:
...
    from wx._core import *
  File
"/usr/lib/python2.3/site-packages/wx-2.5.4-gtk2-ansi/wx/_core.py",
line 11035, in ?
    default = locale.getdefaultlocale()[1]
  File "/usr/lib/python2.3/locale.py", line 346, in
getdefaultlocale
    return _parse_localename(localename)
  File "/usr/lib/python2.3/locale.py", line 280, in
_parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: lt_LT

Attached patch helps.
I also changed Latvian, as ISO8859-13 is an official
standard in both Latvia and Lithuania, and Estonian, as
they use ISO8859-15 now. Also added Windows language
identifiers for all 3 languages.

It can be applied to both 2.3 and 2.4.

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

>Comment By: Nerijus Baliunas (nerijus)
Date: 2006-03-02 02:27

Message:
Logged In: YES 
user_id=3416

OK, it is fixed (workarounded) in wxPython now, but I still
get the same problem (ValueError: unknown locale: lt_LT)
with PyGtk application. But as it won't be fixed in python
2.4 and it is fixed in python 2.5 (svn), I'm closing this issue.

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

Comment By: Nerijus Baliunas (nerijus)
Date: 2005-03-18 02:52

Message:
Logged In: YES 
user_id=3416

I found something. locale.getdefaultlocale()[1] fails if I have:
$ set|grep lt_LT
LANG=lt_LT.ISO8859-13
LC_ALL=lt_LT
LC_CTYPE=lt_LT

But, if I explicitly set LC_ALL=lt_LT.ISO8859-13, it works.
I didn't change my locale settings for years. So something
changed in either wxPython or python.

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

Comment By: Anthony Baxter (anthonybaxter)
Date: 2005-03-16 06:16

Message:
Logged In: YES 
user_id=29957

Please don't mess with the priority settings in the tracker.


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

Comment By: Serge Orlov (sorlov)
Date: 2005-03-10 20:52

Message:
Logged In: YES 
user_id=1235914

That's strange, it works for me, as you see there is no
exception for lt_LT.iso8859-13. I've been using this "fix"
in Linux and Solaris for many years. I'm for applying this
patch to 2.3 and 2.4 but without changing charset as it's
unknown if there are users that depend on the current value. 

Python 2.3.3 (#1, Jun 30 2004, 21:13:17)
[GCC 3.3.3 (SuSE Linux)] on linux2

>>> os.environ['LANG']='lt_LT'
>>> locale.getdefaultlocale()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib64/python2.3/locale.py", line 346, in
getdefaultlocale
    return _parse_localename(localename)
  File "/usr/lib64/python2.3/locale.py", line 280, in
_parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: lt_LT
>>> os.environ['LANG']='lt_LT.iso8859-13'
>>> locale.getdefaultlocale()
['lt_LT', 'iso8859-13']


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

Comment By: Serge Orlov (sorlov)
Date: 2005-03-10 15:33

Message:
Logged In: YES 
user_id=1235914

That's strange, it works for me, as you see there is no
exception for lt_LT.iso8859-13. I've been using this "fix"
in Linux and Solaris for many years. I'm for applying this
patch to 2.3 and 2.4 but without changing charset as it's
unknown if there are users that depend on the current value. 

Python 2.3.3 (#1, Jun 30 2004, 21:13:17)
[GCC 3.3.3 (SuSE Linux)] on linux2

>>> os.environ['LANG']='lt_LT'
>>> locale.getdefaultlocale()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib64/python2.3/locale.py", line 346, in
getdefaultlocale
    return _parse_localename(localename)
  File "/usr/lib64/python2.3/locale.py", line 280, in
_parse_localename
    raise ValueError, 'unknown locale: %s' % localename
ValueError: unknown locale: lt_LT
>>> os.environ['LANG']='lt_LT.iso8859-13'
>>> locale.getdefaultlocale()
['lt_LT', 'iso8859-13']


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

Comment By: Nerijus Baliunas (nerijus)
Date: 2005-03-10 01:47

Message:
Logged In: YES 
user_id=3416

$ set|grep LANG
LANG=lt_LT.ISO8859-13
My LANG is already as you suggest.

OK, I'll ask wxPython developer, as with earlier wxPython
versions I didn't have such problem. But my patch should be
safe anyway.

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

Comment By: Serge Orlov (sorlov)
Date: 2005-03-09 20:31

Message:
Logged In: YES 
user_id=1235914

I don't think the values in locale_alias should be changed
in minor releases (They have been changed in 2.5 as in your
patch)  Please apply changes that only add lt_lt and lv_lv
aliases. I suspect the whole alias thing has wrong values
for many countries (not only in Python). At least it has
wrong values for Russian in Solaris and Linux for more than
ten years. I know that many Russian users have given up
relying on it. They just set charset explicitly: 
LANG=ru_RU.koi8-r or LANG=ru_RU.utf-8. Nerijus,
LANG=lt_LT.ISO8859-13 should work for you. Besides OpenDict
should catch the exception, print a warning and fall back to
C locale if the locale set by the user is not available.

The windows language identifiers are OK to add.

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

Comment By: Nerijus Baliunas (nerijus)
Date: 2005-02-28 00:14

Message:
Logged In: YES 
user_id=3416

I'm increasing priority, as I have real world application
(OpenDict using wxPython) not starting w/o this patch:
$ opendict 
...
ValueError: unknown locale: lt_LT

It's really a very simple patch, please apply it to both 2.3
and 2.4.

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

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1118341&group_id=5470
_______________________________________________
Patches mailing list
[email protected]
http://mail.python.org/mailman/listinfo/patches

Reply via email to