What is wxPython doing to the locale to makes pandas crash?

It looks like the hyphenated “en-US” is coming from the Windows API GetLocaleInfo function. Leave it to Microsoft to do their own thing in an incompatible manner…

I haven’t been able to duplicate whatever it was that prompted me to setup the default locale settings when the wx.App is initialized. So try this: derive a new class from wx.App and override the InitLocale method, like this:

    class MyApp(wx.App):
        def InitLocale(self):
            self.ResetLocale()

Let me know if you run into any locale- or translations-related problems. I have some ideas for an alternate approach that will avoid the ‘en-US’ problem, but if it is no longer needed I can just rip out that chunk of code entirely.

For those who are interested, in Python 3.7 and earlier, on my Windows machine, locale.getlocale() returns (None, None), so it seems that the process’ locale is left in its default state. But in Python 3.8 on Windows it returns ('English_United States', '1252') indicating that Python or something is now setting the locale to the system default. If I remember correctly, the problem I was trying to workaround was that by default wxWidgets would assume that the locale is set to the default “C” locale, and there was something that failed due to that difference. But now I don’t remember what it was that caused the problem back then…

1 Like