469,571 Members | 1,272 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,571 developers. It's quick & easy.

setlocale returns error

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.
Jul 18 '05 #1
3 3647
transam wrote:
I use Mandrake linux 10 with German setup, Hungarian Keyboard.
My Python is python 2.3.3.
[...]
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?


Nothing to do with Python. Enter this (as root):

$ urpmi locales-hu locales-fr locales-nl locales-es
--Irmen
Jul 18 '05 #2
Irmen de Jong <irmen@-nospam-remove-this-xs4all.nl> wrote in message news:<40***********************@news.xs4all.nl>...
Nothing to do with Python. Enter this (as root):

$ urpmi locales-hu locales-fr locales-nl locales-es

--Irmen


Thanks Irmen, it works now fine on linux.

What about windows and other systems?
Does this problem never occur there? If it occurs,
how to cure it?

Regards, tr.
Jul 18 '05 #3
transam wrote:
What about windows and other systems?
Does this problem never occur there? If it occurs,
how to cure it?


First of all, you have to know the locale names for Windows;
they differ from the locale names on Unix. In addition, Windows
installations support only a subset of the locales support in
Windows in general. The only "cure" is to install a different
Windows product. E.g. if you find you are lacking an east-asian
locale, it might be that you need to install an east-asian edition
of Windows, or a multi-lingual edition.

Regards,
Martin

Jul 18 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Dariusz | last post: by
3 posts views Thread by Ksenia Marasanova | last post: by
3 posts views Thread by Damien Elmes | last post: by
3 posts views Thread by J Trauntvein | last post: by
3 posts views Thread by Schraalhans Keukenmeester | last post: by
reply views Thread by Paul Lautman | last post: by
7 posts views Thread by Steven Woody | last post: by
5 posts views Thread by yogeshmk | last post: by
reply views Thread by bestbikeever | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.