Setting my Locale

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Wed Aug 27 00:25:49 EDT 2008


En Tue, 26 Aug 2008 07:52:21 -0300, Robert Rawlins  
<robert.rawlins at thinkbluemedia.co.uk> escribi�:

> 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.setlocale(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.setlocale(locale.LC_ALL, 'de_DE')
>
>   File "/usr/lib/python2.5/locale.py", line 478, in setlocale
>
>     return _setlocale(category, 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.setlocale(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




More information about the Python-list mailing list