Issue797447
This issue tracker has been migrated to GitHub,
and is currently read-only.
For more information,
see the GitHub FAQs in the Python's Developer Guide.
Created on 2003-08-29 18:16 by peter.otten, last changed 2022-04-10 16:10 by admin. This issue is now closed.
Messages (6) | |||
---|---|---|---|
msg18007 - (view) | Author: Peter Otten (peter.otten) * | Date: 2003-08-29 18:16 | |
Python 2.3 (#1, Jul 30 2003, 11:19:43) [GCC 3.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import locale as lo >>> lo.setlocale(lo.LC_ALL, 'de') Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/local/lib/python2.3/locale.py", line 381, in setlocale return _setlocale(category, locale) locale.Error: locale setting not supported The above was taken from the example section of the locale module documentation. But this works: >>> lo.setlocale(lo.LC_ALL, 'de_DE') 'de_DE' >>> So the error message should at least be changed to "unknown/unsupported locale" and the documentation example updated to 'de_DE' instead of 'de'. However, if there are no side effects, I'd prefer to change the locale.setlocale() implementation to always normalize() the locale: def setlocale(category, locale=None): if locale: if type(locale) is not type(""): # convert to string locale = _build_localename(locale) locale = normalize(locale) return _setlocale(category, locale) |
|||
msg18008 - (view) | Author: Peter Otten (peter.otten) * | Date: 2003-08-30 07:29 | |
Logged In: YES user_id=703365 I forgot to mention that the following also works: >>> import locale >>> locale.setlocale(locale.LC_ALL, ("de", None)) 'de_DE.ISO8859-1' >>> So the it really seems to be an implementation rather than a documentation issue. |
|||
msg18009 - (view) | Author: Martin v. Löwis (loewis) * | Date: 2003-08-31 17:00 | |
Logged In: YES user_id=21627 I fail to see the bug. "locale setting not supported" is exactly identical, in its meaning, with "unsupported locale". Changing the example to de_DE won't help much, either, since the next system might support "de" but not "de_DE", or it might support "de_DE.ISO-8859-1" only. Locale names are not standardized. |
|||
msg18010 - (view) | Author: Peter Otten (peter.otten) * | Date: 2003-08-31 21:37 | |
Logged In: YES user_id=703365 (1) I read "locale setting not supported" and understood (not being a native speaker) "(any) locale setting not supported", whereas "unknown/unsupported locale" would make it clear you can set a locale but not the one that was requested. (2) I would expect setlocale(..., "de") and setlocale(..., ("de", None)) to either both fail or both succeed, but currently only the latter form works; thus the proposed change in the code. I hope this clarifies the issue and you will reconsider. |
|||
msg18011 - (view) | Author: Tony Meyer (anadelonbrin) | Date: 2003-09-01 08:02 | |
Logged In: YES user_id=552329 Just my 2c, but I would agree that a wording change to either "unsupported locale setting" or "%s locale setting not supported" with the attempted locale would be much clearer. No opinion on (2) :) |
|||
msg18012 - (view) | Author: Martin v. Löwis (loewis) * | Date: 2003-09-03 04:54 | |
Logged In: YES user_id=21627 This bug is now fixed in liblocale.tex 1.35 _localemodule.c 2.41 _localemodule.c 2.40.4.1 NEWS 1.831.4.28 liblocale.tex 1.33.10.2 by changing the error message, and changing the example to read de_DE. |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-10 16:10:54 | admin | set | github: 39148 |
2003-08-29 18:16:07 | peter.otten | create |