setlocale returns error

transam transam45 at gmx.net
Sat Jun 12 16:17:26 EDT 2004


Hi,

I use Mandrake linux 10 with German setup, Hungarian Keyboard.  
My Python is python 2.3.3.

The following program fails:
---------------------------------------------------------
import locale
loc = locale.setlocale(locale.LC_ALL) # get current locale
locale.setlocale(locale.LC_ALL, 'de_DE') # use German locale; name
might vary with platform
locale.setlocale(locale.LC_ALL, 'hu_HU') # use Hungarian locale; name
might
---------------------------------------------------------
with the error message:
------------------------------------------------------------
  File "test.py", line 4, in ?
    locale.setlocale(locale.LC_ALL, 'hu_HU') # use Hungarian locale;
name might
  File "/usr/lib/python2.3/locale.py", line 381, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting
----------------------------------------------

Has anybody any idea, what can be wrong here?

I checked /etc/locale.
There was une directory there, name: de.
I duplicated that directory under the name 'hu', but this did not
help.

The command locale.setlocale(locale.LC_ALL, xx_YY) work well for 
en_GB, en_US, de_DE, de_CH, de_AT  as xx_YY

and it fails with the unsupported message for:
fr_FR, nl_NL, es_ES, hu_HU as xx_YY

What can be the problem here?

Thanks in advance for any help/hint,

Regards: tr.



More information about the Python-list mailing list