setlocale returns error

T

transam

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.
 
I

Irmen de Jong

transam said:
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
 
T

transam

Irmen de Jong said:
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.
 
?

=?ISO-8859-1?Q?=22Martin_v=2E_L=F6wis=22?=

transam said:
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
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top