473,511 Members | 10,195 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

locale support and 4.10

i'm trying to setlocale() on 4.10, and it appears the python package
doesn't support this under 4.10.

Python 2.3.3 (#2, Apr 28 2004, 22:48:37)
[GCC 2.95.4 20020320 [FreeBSD]] on freebsd4
Type "help", "copyright", "credits" or "license" for more information.
import locale
locale.setlocale(locale.LC_NUMERIC, 'us') Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local/lib/python2.3/locale.py", line 381, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting

the exact same thing works under windows xp.

do i have to compile it with locale support?

also my second question. once i have this working how do i set the
thousands_sep character to be a "," ?
Jul 18 '05 #1
4 1737
Timothy Smith wrote:
>>> locale.setlocale(locale.LC_NUMERIC, 'us')
the exact same thing works under windows xp.
do i have to compile it with locale support?


No. You have to choose a locale name that is supported by your
operating system (which appears to be FreeBSD). Read your OS
documentation for what valid locale names are; most likely,
"en_US" or "en_US.ISO-8859-1" are supported.
also my second question. once i have this working how do i set the
thousands_sep character to be a "," ?


You don't directly set it. It is a property of the locale.

Regards,
Martin
Jul 18 '05 #2
Martin v. Löwis wrote:
Timothy Smith wrote:
>>> locale.setlocale(locale.LC_NUMERIC, 'us')

the exact same thing works under windows xp.
do i have to compile it with locale support?

No. You have to choose a locale name that is supported by your
operating system (which appears to be FreeBSD). Read your OS
documentation for what valid locale names are; most likely,
"en_US" or "en_US.ISO-8859-1" are supported.
also my second question. once i have this working how do i set the
thousands_sep character to be a "," ?

You don't directly set it. It is a property of the locale.

Regards,
Martin


something strange is happening, no matter what i try nothing is a
supported locale
and yes it's freebsd 4.10
Jul 18 '05 #3
Timothy Smith wrote:
something strange is happening, no matter what i try nothing is a
supported locale and yes it's freebsd 4.10


Sounds like a problem with your operating system. AFAICT, you ought
to have a directory /usr/share/locale on your disk. What is its
contents?

Regards,
Martin
Jul 18 '05 #4
Timothy Smith <ti*****@open-networks.net> writes:
something strange is happening, no matter what i try nothing is a
supported locale
and yes it's freebsd 4.10


AFAIK, the locale support in FreeBSD 4.1 is incomplete. Support for
LC_NUMERIC was only added in 4.6 - the release notes for 4.6 say:

The locale support was synchronized with the code from FreeBSD
-CURRENT. This change brings support for the LC_NUMERIC,
LC_MONETARY, and LC_MESSAGES categories, as well as improvements to
strftime(3), revised locale definitions, and improvement of the
localization of many base system programs.

HTH

--
Michael Piotrowski, M.A. <mx*@dynalabs.de>
Public key at <http://www.dynalabs.de/mxp/pubkey.txt>
Jul 18 '05 #5

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

Similar topics

3
3875
by: Adrian Parker | last post by:
I have a server app which is sent a date in the local format of the client machine. I've no control over the client app at all, so have to code at the server end to cope with any problems. The...
9
3566
by: Nuff Said | last post by:
When I type the following code in the interactive python shell, I get 'UTF-8'; but if I put the code into a Python script and run the script - in the same terminal on my Linux box in which I...
3
3233
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...
4
7829
by: Roger Leigh | last post by:
Hello, I'm writing a fixed-precision floating point class, based on the ideas in the example fixed_pt class in the "Practical C++ Programming" book by Steve Oualline (O' Reilly). This uses a...
3
2394
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...
10
2265
by: David Thielen | last post by:
Hi; I have help html pages for each page of my ASP.NET webapp. So for the page datasource.aspx, I have help\datasource.htm. Bu what I want when the hyperlink is clicked, for it to look for the...
33
19130
by: Simon Brooke | last post by:
I'm working on a system which uses Google maps. I want the user to see a map of more or less where (s)he is in the world when (s)he first comes to the system. So the obvious thing seemed to be to...
24
3340
by: Donn Ingle | last post by:
Hello, I hope someone can illuminate this situation for me. Here's the nutshell: 1. On start I call locale.setlocale(locale.LC_ALL,''), the getlocale. 2. If this returns "C" or anything...
0
1049
by: Gabriel Genellina | last post by:
En Tue, 26 Aug 2008 07:52:21 -0300, Robert Rawlins <robert.rawlins@thinkbluemedia.co.ukescribi�: Probably you don't have support for 'de_DE' locale. Try using locale.setlocale(locale.LC_ALL,...
0
7430
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...
1
7089
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...
1
5072
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...
0
4743
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...
0
3230
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3217
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1581
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
790
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
451
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...

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.