Windows locale error: wx._core.wxAssertionError

Hi, I’m using GRASS, a GIS application created using wxPython. Every time I try to load a dataset, I get the following error:
C:\Users\Ishan Buxy>Traceback (most recent call last):
File “C:\Program Files\GRASS GIS 7.8\gui\wxpython\wxgui.py”, line 105, in OnInit
mainframe = GMFrame(parent=None, id=wx.ID_ANY,
File “C:\Program Files\GRASS GIS 7.8\gui\wxpython\lmgr\frame.py”, line 141, in init
self._createMenuBar()
File “C:\Program Files\GRASS GIS 7.8\gui\wxpython\lmgr\frame.py”, line 268, in _createMenuBar
self.menubar = GMenu(
File “C:\Program Files\GRASS GIS 7.8\gui\wxpython\gui_core\menu.py”, line 47, in init
self.Append(self._createMenu(child), child.label)
File “C:\Program Files\GRASS GIS 7.8\gui\wxpython\gui_core\menu.py”, line 61, in _createMenu
self._createMenuItem(menu, label=child.label, **data)
File “C:\Program Files\GRASS GIS 7.8\gui\wxpython\gui_core\menu.py”, line 88, in _createMenuItem
menuItem.SetBitmap(MetaIcon(img=icon).GetBitmap(self.bmpsize))
File “C:\Program Files\GRASS GIS 7.8\gui\wxpython\icons\icon.py”, line 96, in GetBitmap
image = wx.Image(name=self.imagepath)
wx._core.wxAssertionError: C++ assertion “strcmp(setlocale(0, 0), “C”) == 0” failed at D:\src\osgeo4w\src\wxwidgets\wxwidgets-3.1.5-0df1d81acd6f1be8624022f8eecb51679008ca40\src\common\intl.cpp(1694) in wxLocale::GetInfo(): You probably called setlocale() directly instead of using wxLocale and now there is a mismatch between C/C++ and Windows locale.
Things are going to break, please only change locale by creating wxLocale objects to avoid this!
OnInit returned false, exiting…

Does anyone know how to resolve this?

I have struggled with locale issues with Python 3+ and wxPython 4.0+ and the only way I have discovered to solve the problem completely is to initialize the app as follows:

import locale
# Initialize the app first
app = wx.App(False)
# Now force the locale to the "compatible" 'C' locale
locale.setlocale(locale.LC_ALL, 'C')

This is wrong (but unfortunately the gist of the only
solution). Wrong because it will make Python code that’s
running “below” wxPython behave locale-INsensitive.

And sometimes we can’t even follow the “advice”: “So, use
wx.Locale() already”:

Let’s say you’ve got a Python module which uses string
formatting, which is locale dependant (say, the
thousands-separator). Now, if you re-set

locale.setlocale(locale.LC_ALL, 'C')

after initializing wx.App() that string formatting module
will fail to provide proper output.

I strongly believe wxPython should only attempt to
auto-init the locale if it is “C” when tested upon startup.
Otherwise, set it to whatever already exists (because that is
what earlier Python code had set it to !).

Best,
Karsten

This should be corrected to

… wxWIDGETS should only attempt to …

Karsten