https://bugzilla.wikimedia.org/show_bug.cgi?id=58872
Web browser: ---
Bug ID: 58872
Summary: Set locale if system uses wrong default
Product: Pywikibot
Version: core (2.0)
Hardware: All
OS: All
Status: NEW
Severity: major
Priority: Unprioritized
Component: General
Assignee: [email protected]
Reporter: [email protected]
Classification: Unclassified
Mobile Platform: ---
The grid engine on tool labs has another default locale setting than the
console.
Grid engine:
>>> import locale
>>> print locale.localeconv()
{'mon_decimal_point': '', 'int_frac_digits': 127, 'p_sep_by_space': 127,
'frac_digits': 127, 'thousands_sep': '', 'n_sign_posn': 127, 'decimal_point':
'.', 'int_curr_symbol': '', 'n_cs_precedes': 127, 'p_sign_posn': 127,
'mon_thousands_sep': '', 'negative_sign': '', 'currency_symbol': '',
'n_sep_by_space': 127, 'mon_grouping': [], 'p_cs_precedes': 127,
'positive_sign': '', 'grouping': []}
>>> print locale.getdefaultlocale()
(None, None)
>>> print locale.getlocale()
(None, None)
>>> print locale.getpreferredencoding()
ANSI_X3.4-1968
Console:
>>> import locale
>>> print locale.localeconv()
{'mon_decimal_point': '', 'int_frac_digits': 127, 'p_sep_by_space': 127,
'frac_digits': 127, 'thousands_sep': '', 'n_sign_posn': 127, 'decimal_point':
'.', 'int_curr_symbol': '', 'n_cs_precedes': 127, 'p_sign_posn': 127,
'mon_thousands_sep': '', 'negative_sign': '', 'currency_symbol': '',
'n_sep_by_space': 127, 'mon_grouping': [], 'p_cs_precedes': 127,
'positive_sign': '', 'grouping': []}
>>> print locale.getdefaultlocale()
('en_US', 'UTF-8')
>>> print locale.getlocale()
(None, None)
>>> print locale.getpreferredencoding()
UTF-8
The one from console works with pywikibot, the other one not, see Bug 58181.
Essentially the issue is that the locale on the grid engine is not set
properly. But it is not important where this error comes from, the bots must
not crash in such situations.
I propose to check 'locale.getdefaultlocale()' on startup and compare it to
'config.textfile_encoding' (may be also 'config.console_encoding') IFF they
mismatch, the encoding has to be set according to config in order to use the
correct one.
--
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
Wikibugs-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/wikibugs-l