473,663 Members | 2,726 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.setlocal e(locale.LC_ALL ) # get current locale
locale.setlocal e(locale.LC_ALL , 'de_DE') # use German locale; name
might vary with platform
locale.setlocal e(locale.LC_ALL , 'hu_HU') # use Hungarian locale; name
might
---------------------------------------------------------
with the error message:
------------------------------------------------------------
File "test.py", line 4, in ?
locale.setlocal e(locale.LC_ALL , 'hu_HU') # use Hungarian locale;
name might
File "/usr/lib/python2.3/locale.py", line 381, in setlocale
return _setlocale(cate gory, 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.setlocal e(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 3819
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.n l>...
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1816
by: Dariusz | last post by:
I am writing a guestbook script using MySQL, the part of the script below is a loop which executes to read from the database all the input data to print it out to screen. 1) In the $gbDate line, the $T argument displays as $T instead of the actual time in Windows. Is this a fault in Windows, or have I done something wrong? Webpage will eventually be in Unix server online. 2)
3
3243
by: Ksenia Marasanova | last post by:
Hi, I have some problems with locale module. On my workstation, changing locale doesn't have effect: Python 2.3 (#1, Sep 13 2003, 00:49:11) on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import locale >>> locale.setlocale(locale.LC_ALL, 'nl_NL')
3
1586
by: Damien Elmes | last post by:
Hi folks, I've got a module + C extension which provides on screen display support in X, via libxosd (http://repose.cx/pyosd). I've recently had a report of trouble where a Russian user was unable to display any Russian text. I've managed to resolve the issue by inserting the following two lines at the start of the application:
3
2784
by: J Trauntvein | last post by:
I was working with a co-worker the other day to work through the process of formatting numeric values by imbueing C++ iostreams with locales. His program's initialisation code had a call to setlocale("",LC_ALL) which I believe sets up locale information for the C run time library but is not supposed to effect the C++ run time. What we found, however, was that, with this function call in place, the C++ iostreams were formatting floating...
3
7098
by: Schraalhans Keukenmeester | last post by:
Hi, I run Apache 1.3.33 and PHP 5.0.4 on my Suse9.2 Linux box. If I try any of the following: setlocale (LC_TIME,'nl'); setlocale (LC_TIME,'nl_NL'); //example php.net site setlocale (LC_TIME,'NL'); setlocale (LC_TIME,'Dutch'); setlocale (LC_TIME,'nl-NL');
0
1379
by: Paul Lautman | last post by:
Last night I had a web site. This morning it was returning nothing. I traced it to a call to setlocale(). It appears that something has happened that means that any call to setlocale completely kills the site, including dumping anything that is in the output buffer. Take a look at http://www.osg-uk.com/st.php and http://www.osg-uk.com/sts.php the contents of which are shown below. Anyone got any ideas? st.php:
7
2622
by: Steven Woody | last post by:
Hi, I am in Linux writing a program using setlocale(3). But I found, only the first invocation of setlocale(3) can be success, any subsequent calling of this function will fail $B!J(B return NULL ) and the locale is not changed. Is there any tip here? Thanks.
5
5711
by: yogeshmk | last post by:
I'm writing an application which is required to function with many languages and also compile on Linux & windows. Here's how I find the locale .. # include <stdio.h> # include <locale.h> int main(void) {
0
1492
by: bestbikeever | last post by:
from manual: Warning: The locale information is maintained per process, not per thread. If you are running PHP on a multithreaded server api like IIS or Apache on Windows you may experience sudden changes of locale settings while a script is running although the script itself never called setlocale() itself. This happens due to other scripts running in different threads of the same process at the same time changing the processwide...
0
8436
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8345
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8858
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8771
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8548
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6186
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4349
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2000
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1757
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.