wxPython4.1.1 Python3.8 locale wxAssertionError

Yep, the change that started causing this problem turned up in Python 3.8.

I’ve been thinking of trying to simplify InitLocale much like this, instead of trying to bring the C runtime and wxWIdgets into sync with what the system thinks should be the default. I’ve made the following change in a test app that shows the problem for me, and it works fine, but I’m in a US locale and don’t need to do anything related to the locale other than this.

So for those that are using non-US locales, especially if you also need to create a wx.Locale for access to message catalogs, or other locale specific things please try the experiment and let us know how it goes.

The experiment is to simply add the following method to your wx.App-derived class. If you also need to set an explicit wx.Locale then do so after the code above, and remember to hold on to the reference to the wx.Local object.

    def InitLocale(self):
        import sys
        if sys.platform.startswith('win') and sys.version_info > (3,8):
            import locale
            locale.setlocale(locale.LC_ALL, "C")

Please reply with how it works for you, and if it doesn’t help then also reply with any clues you may have discovered.