Failure to set locale
Martin v. Löwis
loewis at informatik.hu-berlin.de
Mon Jul 22 07:59:51 EDT 2002
david at forestfield.co.uk (David Hughes) writes:
> As a fairly-newbie, I'm trying to use the locale module for the
> first time, using Python 2.2 under Win2k. If I call locale.setlocale
> with a locale of 'de' for Germany or 'es' for Spain, I get "Error:
> locale setting not supported".
Right, you have to use 'german' on Windows; apparently abbreviations
are accepted as well.
> However, if I use 'ge' and 'sp'(which aren't the ISO approved
> names), the correct locale is set.
No argument to setlocale is ISO-approved. Python inherits setlocale
from ISO 9899 (ISO C), not from any other ISO standard. In ISO 9899,
the valid arguments for setlocale are specifically documented as
implementation-defined.
> The only way I can get the locale set for Denmark is to actually
> change the region in Windows' Control Panel.
Try "danish", or "danish_Denmark.1252", if you want the full locale
name.
> Can anyone suggest what's going wrong, please?
You are passing unsupported locale names to setlocale.
Regards,
Martin
More information about the Python-list
mailing list