By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,888 Members | 1,432 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,888 IT Pros & Developers. It's quick & easy.

setlocale returns error

P: n/a
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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.