473,587 Members | 2,487 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Re: Setting my Locale

En Tue, 26 Aug 2008 07:52:21 -0300, Robert Rawlins
<ro************ @thinkbluemedia .co.ukescribiï¿ ½:
I'm running python 2.5 on a Debian based system and I'm looking for your
advice on how to set the locale for my application. I've read through the
locale module documentation http://docs.python.org/lib/module-locale.html
and tried a couple of the examples but can't seem to get it working.
For instance, when I attempt to run the following code:
import locale

locale.setlocal e(locale.LC_ALL , 'de_DE')
I get an exception raised by the application which says:
Traceback (most recent call last):

File "locale_test.py ", line 2, in <module>

locale.setlocal e(locale.LC_ALL , 'de_DE')

File "/usr/lib/python2.5/locale.py", line 478, in setlocale

return _setlocale(cate gory, locale)

locale.Error: unsupported locale setting
My questions are; what would be causing this error? Do I need any
additional
packages installed on the system for this locale support to work
properly?
Probably you don't have support for 'de_DE' locale.
Try using locale.setlocal e(locale.LC_ALL , '')
and see what you get in response.
How can I get a list of available locales?
I'd like to know how to retrieve that too...

--
Gabriel Genellina

Aug 27 '08 #1
0 1050

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1698
by: Jim Seymour | last post by:
I have this thing I wrote called "Simple Contact Form." It's just a straight-forward contact form. (Rather than repeat myself, check out http://jimsun.linxnet.com/SCForm.html if you need to know more.) I just received this email: In the swedish alphabet we have three characters, å (an a with a smal circle over it) ä ( an a with two spots ower it) and ö ( an o with two spots over it). When I use the emailform those chacters doesn't...
4
10030
by: Grumfish | last post by:
Is there a way to tell Java what localization to use so applications and the compiler doesn't default to the system's setting? I'm using a computer with Windows 2000 with a regional setting of Japanese. Is there any way to have Java always use US English rather than the default Japanese?
0
1414
by: Darren | last post by:
I used the following code on a server; <% ReturnDateTime 1033, "English (US)" ReturnDateTime 2057, "English (UK)" ReturnDateTime 3081, "English (Australia)" ReturnDateTime 1031, "German" Sub ReturnDateTime(locale, description) Session.LCID = locale
1
3342
by: David Lee AU | last post by:
We have an ASP.NET page that displays a date without a format specifier (in order to determine to default locale setting) and the date is shown as mm/dd/yyyy. We previously were able to set the locale to Australian values (incl date format of dd/mm/yyyy) using KB271587. I have recently installed the v1.1 of the .NET Framework and the format has reverted to the mm/dd/yyyy format. How can I set the locale settings to use the Austrlian locale...
3
2398
by: Torsten Bronger | last post by:
Hallöchen! I have to generate excerpts in different human languages in a program. In general, the language is not the locale's language, but set at runtime. Nevertheless, GNU's gettext should be used for the excerpts. This means that I have to wrap calls to gettext() in a function that sets the locale temporarily. The problem is how to do that. Let's assume I need to generate German snippets. Then I could say
6
2987
by: Troels Arvin | last post by:
Hello, In the init-script contained in the RPMs downloadable from the PostgreSQL site (I checked the one for Fedora), an explicit locale is set before running initdb. - And the explicit locale is not "C". This means that a PostgreSQL installation will not use indexes for LIKE queries (I just ran into this). See http://www.postgresql.org/docs/faqs/FAQ.html#4.8
3
7188
by: robert | last post by:
Why can the default locale not be set by its true name? but only by '' ? : PythonWin 2.5 (r25:51908, Sep 19 2006, 09:52:17) on win32. (None, None) Traceback (most recent call last): File "<interactive input>", line 1, in <module> File "C:\Python25\lib\locale.py", line 476, in setlocale return _setlocale(category, locale) Error: unsupported locale setting
2
11909
by: cris | last post by:
Hi, I got trouble when I try to change the locale used in a program foo.cc // ----------------- begin #include <iostream> #include <locale> #include <exception> using namespace std; int main(int argc, char** argv)
1
4199
by: Torsten Bronger | last post by:
Hallöchen! I start a python script with subprocess from another Python script with python = subprocess.Popen(, stdout=subprocess.PIPE, stderr=subprocess.PIPE) However, this child script has sys.stdout.encoding set to None, which means that Unicode strings cannot be printed without trouble.
0
7923
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
7852
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
8216
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
8349
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
7974
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,...
0
8221
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6629
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5395
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.