[issue21731] Calendar Problem with Windows (XP)

2021-12-06 Thread Irit Katriel


Change by Irit Katriel :


--
resolution:  -> duplicate
stage:  -> resolved
status: open -> closed
superseder:  -> locale.py resetlocale throws exception on Windows 
(getdefaultlocale returns value not usable in setlocale)

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21731] Calendar Problem with Windows (XP)

2014-06-12 Thread Jürgen B

New submission from Jürgen B:

I had a problem with calendar.formatmonth()
Error message was 'Unsupported Locale'

Well, it seems that Windows (XP) does nothing accept to setlocale than ''

I changed /lib/calendar.py line 488 ff to
class different_locale:
def __init__(self, locale):
self.locale = locale

def __enter__(self):
_locale.setlocale(_locale.LC_TIME, '') # juebo
self.oldlocale = _locale.getlocale(_locale.LC_TIME)
# _locale.setlocale(_locale.LC_TIME, self.locale) # juebo

def __exit__(self, *args):
# _locale.setlocale(_locale.LC_TIME, self.oldlocale) #juebo
_locale.setlocale(_locale.LC_TIME, '')

Well, I am absolute new to Python. So could anybody look over it

--
components: Library (Lib)
messages: 220341
nosy: Juebo
priority: normal
severity: normal
status: open
title: Calendar Problem with Windows (XP)
type: compile error
versions: Python 2.7, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21731
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21731] Calendar Problem with Windows (XP)

2014-06-12 Thread R. David Murray

R. David Murray added the comment:

The code is mostly correct as it exists in the calendar module.  You are 
running into issue 10466.  Per my comment in that issue, it may be possible to 
put a workaround into the calendar module, but your suggestion isn't it, since 
your code would leave the locale modified, not restored to its value before the 
calendar function was called.

What happens if you replace the original setlocale call in __enter__ with a 
try/except, and if the set fails, redo the set call using ''?  Does the save of 
oldlocale and its restore work in that case?

--
nosy: +r.david.murray

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21731
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue21731] Calendar Problem with Windows (XP)

2014-06-12 Thread Jürgen B

Jürgen B added the comment:

Yes, Issue 10466 seems to be the same problem. One could fix this one instance 
higher, not necessarily in Calendar.py.

As I said, I have no idea about Python (not yet). You could code this and I 
would test it.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue21731
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com