locale.getlocale() strange behaviour

  • Thread starter =?iso-8859-1?q?Beno=EEt_Dejean?=
  • Start date
?

=?iso-8859-1?q?Beno=EEt_Dejean?=

here are my locales


benoit@athlon >> locale
LANG=fr_FR.UTF-8
LC_CTYPE="fr_FR.UTF-8"
LC_NUMERIC="fr_FR.UTF-8"
LC_TIME="fr_FR.UTF-8"
LC_COLLATE="fr_FR.UTF-8"
LC_MONETARY="fr_FR.UTF-8"
LC_MESSAGES="fr_FR.UTF-8"
LC_PAPER="fr_FR.UTF-8"
LC_NAME="fr_FR.UTF-8"
LC_ADDRESS="fr_FR.UTF-8"
LC_TELEPHONE="fr_FR.UTF-8"
LC_MEASUREMENT="fr_FR.UTF-8"
LC_IDENTIFICATION="fr_FR.UTF-8"
LC_ALL=fr_FR.UTF-8



(full utf-8 system)


(None, None)
(None, None)
Python 2.3.3 (#2, Feb 24 2004, 09:29:20)
[GCC 3.3.3 (Debian)] on linux2
Type "help", "copyright", "credits" or "license" for more information.(None, None)

Python 2.2.3+ (#1, Feb 25 2004, 23:29:31)
[GCC 3.3.3 (Debian)] on linux2
Type "help", "copyright", "credits" or "license" for more information.['fr_FR', 'utf']


2.3 fails getting locale
but 2.2 also fails when running inline :/

makes me crazy :D
 
J

Jeff Epler

Just as in C programs, the LANG and LC_* environment variables have no
effect until setlocale is called with "" as the second argument.

On my system:
$ echo $LANG
en_US.UTF-8
$ python -c 'import locale; print locale.getlocale()'
(None, None)
$ python -c 'import locale; locale.setlocale(locale.LC_ALL, ""); print locale.getlocale()'
['en_US', 'utf']

In Python2.2 on my system, setlocale() is called by rl_initialize() when
I run the interactive interpreter.
$ python -c 'import locale; import readline; print locale.getlocale()'
['en_US', 'utf']
this may explain the behavior you noticed.

Jeff
 
?

=?iso-8859-1?q?Beno=EEt_Dejean?=

Le Tue, 02 Mar 2004 20:09:26 -0600, Jeff Epler a écrit :
In Python2.2 on my system, setlocale() is called by rl_initialize() when
I run the interactive interpreter.
$ python -c 'import locale; import readline; print locale.getlocale()'
['en_US', 'utf']
this may explain the behavior you noticed.

thanks a lot
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,143
Latest member
DewittMill
Top