[issue10092] calendar does not restore locale properly

Boštjan Mejak report at bugs.python.org
Wed Dec 1 22:21:41 CET 2010


Boštjan Mejak <bostjan.mejak at gmail.com> added the comment:

Yes, I know this issue is closed but I wonder how could your Python
interpreter not error on
>>> calendar.LocaleTextCalendar(locale='fr_FR').formatmonthname(2010,10,10)

Please retry executing the above line of code in Python 2.7.1 interpreter
and tell me if you get an error. I get this:
>>> import calendar
>>> calendar.LocaleTextCalendar(locale='fr_FR').formatmonthname(2010,10,10)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\calendar.py", line 522, in formatmonthname
    with TimeEncoding(self.locale) as encoding:
  File "C:\Python27\lib\calendar.py", line 490, in __enter__
    _locale.setlocale(_locale.LC_TIME, self.locale)
  File "C:\Python27\lib\locale.py", line 531, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

----------
Added file: http://bugs.python.org/file19894/unnamed

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10092>
_______________________________________
-------------- next part --------------
Yes, I know this issue is closed but I wonder how could your Python interpreter not error on<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; color: rgb(80, 0, 80); ">&gt;&gt;&gt; calendar.LocaleTextCalendar(locale=&#39;fr_FR&#39;).formatmonthname(2010,10,10)</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; color: rgb(80, 0, 80); "><br></span></div><div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; color: rgb(80, 0, 80); ">Please retry executing the above line of code in Python 2.7.1 interpreter and tell me if you get an error. I get this:</span></div>
<div><span class="Apple-style-span" style="font-family: arial, sans-serif; font-size: 13px; border-collapse: collapse; color: rgb(80, 0, 80); "><div>&gt;&gt;&gt; import calendar</div><div>&gt;&gt;&gt; calendar.LocaleTextCalendar(locale=&#39;fr_FR&#39;).formatmonthname(2010,10,10)</div>
<div>Traceback (most recent call last):</div><div>  File &quot;&lt;stdin&gt;&quot;, line 1, in &lt;module&gt;</div><div>  File &quot;C:\Python27\lib\calendar.py&quot;, line 522, in formatmonthname</div><div>    with TimeEncoding(self.locale) as encoding:</div>
<div>  File &quot;C:\Python27\lib\calendar.py&quot;, line 490, in __enter__</div><div>    _locale.setlocale(_locale.LC_TIME, self.locale)</div><div>  File &quot;C:\Python27\lib\locale.py&quot;, line 531, in setlocale</div>
<div>    return _setlocale(category, locale)</div><div>locale.Error: unsupported locale setting</div></span></div>


More information about the Python-bugs-list mailing list