[Python-Dev] Failure of test__locale common on OS X?

Steven Majewski sdm7g at mac.com
Sat Oct 11 22:00:28 EDT 2003


tkFileDialog also fails when run as a main module:
% pythonw tkFileDialog.py
Traceback (most recent call last):
 File "tkFileDialog.py", line 189, in ?
 locale.setlocale(locale.LC_ALL,'')
 File 
"/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/ 
locale.py", line 381, in setlocale
 return _setlocale(category, locale)
locale.Error: locale setting not supported
All the functions seem to work ok when imported. The problem is the 
following
in the 'if __name__ == "__main__" : ' clause:
 # See whether CODESET is defined
 try:
 import locale
 locale.setlocale(locale.LC_ALL,'')
 enc = locale.nl_langinfo(locale.CODESET)
 except (ImportError, AttributeError):
 pass
The tail end of the OSX setlocale man page reads:
------------------------------------------------------------------------ 
---------------------------------
STANDARDS
 The setlocale() and localeconv() functions conform to ISO/IEC 
9899:1990
 (``ISO C89'').
HISTORY
 The setlocale() and localeconv() functions first appeared in 
4.4BSD.
BUGS
 The current implementation supports only the "C" and "POSIX" 
locales for
 all but the LC_COLLATE, LC_CTYPE, and LC_TIME categories.
 In spite of the gnarly currency support in localeconv(), the 
standards
 don't include any functions for generalized currency formatting.
 Use of LC_MONETARY could lead to misleading results until we have 
a real
 time currency conversion function. LC_NUMERIC and LC_TIME are 
personal
 choices and should not be wrapped up with the other categories.
BSD June 9, 1993 
 BSD
------------------------------------------------------------------------ 
--------------------------------
In fact, setlocale( LC_ALL, "POSIX" ) and setlocale( LC_ALL, "C" ) both 
work.
( Some other things also don't work, but I'm not sure exactly what 
things should work. )
-- Steve Majewski


More information about the Python-Dev mailing list

AltStyle によって変換されたページ (->オリジナル) /