-
Notifications
You must be signed in to change notification settings - Fork 521
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Datetime.strptime error in wxPython why #1637
Comments
See also pyinstaller/pyinstaller#4874 |
I'm seeing this too with wxPython 4.1.0 (and Python 3.8.1 MSW 64 bit, for the record).
However, if the locale is set using the Python locale module, it doesn't:
No traceback in this case. It seems to be a usable workaround. Note that some older 4.0.x wxPython's insisted on the opposite, requiring wx.Locale instead of Python locale, as seen in this assertion failure from 4.0.4 wx.Image.ConvertToBitmap: Edited to add:
It seems locale.setlocale is not a usable workaround after all. |
For those seeing this, what does |
|
|
@RobinD42 perhaps in the case where Python's |
|
What confuses me about the error message is the hyphen. Because the usual notation uses an underscore. >>> locale.setlocale(locale.LC_ALL, ('en-US', 'UTF-8'))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.8/locale.py", line 608, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting
>>> locale.setlocale(locale.LC_ALL, ('en_US', 'UTF-8'))
'en_US.UTF-8'
>>> See also |
There will be a new version of |
4.1.1a1 is an improvement, so long as you stick with default locale everything seems fine:
But setting a different locale does not work:
|
Update: wxPython 4.1.1/wxWidgets 3.1.5 is out, and it works exactly like 4.1.1a1. It's a showstopper, so I remain stuck on 4.0.7/3.0.5. |
This issue has been mentioned on Discuss wxPython. There might be relevant details there: https://discuss.wxpython.org/t/wxpython4-1-1-python3-8-locale-wxassertionerror/35168/2 |
For those still having issues with this and are using non-US locales, please try this experiment. The root of the problem started when Python 3.8+ on Windows started changing the locale to something other than the default unset value, so perhaps the simplest thing that can be done is to just change it back to "C" instead of overdoing things to try and bring the C runtime and wxWIdgets into sync with what the system thinks should be the default. So try adding the following method to your
If you also need to set an explicit Please reply with how it works for you, and if it doesn't help then also reply with any clues you may have discovered. |
Tried the
|
If I'm understanding 040c59f correctly, isn't it just the workaround above, which means that in order to choose the default locale, you now have to override I guess this is really a CPython bug in |
@RobinD42 is it worth taking this locale issue to upstream Python (perhaps to the person who implemented the change on Windows) and ask for advice on how to resolve it? |
I came across a PC where it goes wrong even if you don't set the locale at all:
I added the two At this point I'm struggling to find any way to write a wxPython program that will run on computers with varying locales. I'm beginning to think monkeypatching |
This issue has been mentioned on Discuss wxPython. There might be relevant details there: https://discuss.wxpython.org/t/questions-on-the-locale-issue/36084/1 |
The text was updated successfully, but these errors were encountered: