usefullness of pythons' builtin locale functions on Windows
Gerson Kurz
moc.q-dnan-p at p-nand-q.com
Wed Aug 7 02:27:52 EDT 2002
The documentation for strftime in the module time says
%x Locale's appropriate date representation.
%X Locale's appropriate time representation.
I run W2k, with a german locale selected. (Which works in nearly all
other programs I run). I'm using
PythonWin 2.2.1 (#34, Apr 15 2002, 09:51:39) [MSC 32 bit (Intel)] on
win32.
So, I tried this:
>>> import time
>>> time.strftime( "%x %X" )
'08/07/02 08:15:37'
The date format is incorrect for german users, it uses MM/DD/YY where
we would normally write DD.MM.YYYY. So, I look at module "locale"
>>> import locale
>>> locale.setlocale( locale.LC_ALL, "de" )
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "C:\Python22\lib\locale.py", line 372, in setlocale
return _setlocale(category, locale)
Error: locale setting not supported
The documentation says: "The nl_langinfo function accepts one of the
following keys. Most descriptions are taken from the corresponding
description in the GNU C library". However, there is no nl_langinfo on
my system:
>>> locale.nl_langinfo
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
AttributeError: 'module' object has no attribute 'nl_langinfo'
Do I really have to resort to import win32api? That reminds me of the
situation with shutil (see <news:3ce4eebb.26302437 at News.CIS.DFN.DE>).
Shouldn't these lib functions be made portable? The app I'm working on
runs is intended to run on both linux and win32, and I was hoping that
I could rely on pythons' stdlib to be portable.
More information about the Python-list
mailing list