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.

作者 lemburg
收信人 AndersMunch, lemburg, paul.moore, steve.dower, swt2c, tim.golden, zach.ware
日期 2021-02-17.10:19:36
SpamBayes Score -1.0
Marked as misclassified
Message-id <6be9339a-a10d-c4c7-6009-48841d0d191e@egenix.com>
In-reply-to <1613555738.14.0.398836728759.issue43115@roundup.psfhosted.org>
内容
On 17.02.2021 10:55, Anders Munch wrote:
>>>> import locale
>>>> locale.setlocale(locale.LC_ALL, 'en_DE')
> 'en_DE'
>>>> locale.getlocale()
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "C:\flonidan\env\Python38-64\lib\locale.py", line 591, in getlocale
>     return _parse_localename(localename)
>   File "C:\flonidan\env\Python38-64\lib\locale.py", line 499, in _parse_localename
>     raise ValueError('unknown locale: %s' % localename)
> ValueError: unknown locale: en_DE

The locale module does not know this encoding, so cannot
guess the encoding. Since getlocale() returns the language
code and encoding, this fails.

If you add the encoding, you should be fine:

>>> locale.setlocale(locale.LC_ALL, 'en_DE.UTF-8')
'en_DE.UTF-8'
>>> locale.getlocale()
('en_DE', 'UTF-8')
历史
日期 用户 动作 参数
2021-02-17 10:19:37lemburg修改recipients: + lemburg, paul.moore, tim.golden, zach.ware, steve.dower, swt2c, AndersMunch
2021-02-17 10:19:37lemburg链接issue43115 messages
2021-02-17 10:19:36lemburg创建