Hi,
There is an asymmetry in getlocale and setlocale. What is returned by getlocale
cannot be used
as argument for setlocale. It is important to mention that this is on Windows
7. Setlocale appears
to use a Linux/Posix locale specification (yaay, harmony!), but,
disappointingly, getlocale still returns
the windows-specific locale specification. Why is this? Is this some historical
anomaly?
Background: I occasionally need to use a french locale because that locale uses
a space as a thousand separator.
So I'd like to temporarily change that, then fire up Excel, which hopefully
ensures the numbers are displayed
as desired.
#Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)]
on win32
>>> import platform
>>> platform.platform()
'Windows-7-6.1.7601-SP1'
>>> import locale
>>> locale.getlocale()
('Dutch_Netherlands', '1252')
>>> locale.setlocale(locale.LC_ALL, "French_France")
'French_France.1252'>>> locale.getlocale()
('fr_FR', 'cp1252')
>>> locale.setlocale(locale.LC_ALL, ('fr_FR', 'cp1252'))
Traceback (most recent call last):
File "<pyshell#10>", line 1, in <module>
locale.setlocale(locale.LC_ALL, ('fr_FR', 'cp1252'))
File "C:\Python27\lib\locale.py", line 531, in setlocale
return _setlocale(category, locale)
Error: unsupported locale setting
Regards,
Albert-Jan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public
order, irrigation, roads, a
fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor