Re: Getting wx._core.wxAssertionError

Peter Clarke <[email protected]> Sat, 11 Dec 2021 15:20:50 -0800 (PST)
Newsgroups gmane.comp.python.wxpython
Message-ID <[email protected]>
------=_Part_1450_410409320.1639264850696
Content-Type: multipart/alternative; 
	boundary="----=_Part_1451_231735221.1639264850696"

------=_Part_1451_231735221.1639264850696
Content-Type: text/plain; charset="UTF-8"

I've seen a similar issue recently in my own code. When I started using 
wx.Locale, an unrelated part of the code started throwing this error. The 
specific line throwing the error creates the first instance of wx.Image. 
The only way I've found to resolve it so far is either (1) get rid of 
wx.Locale usage completely, or (2) get rid of wx.Image usage. Not a 
pleasant choice.

I found the error was coming up on specific Windows machines only. I have 
not seen it on my own Windows or Mac. It first showed up on my colleague's 
Windows PC - she's Indian. As the OP has a .in email address, I wonder if 
it's a particular issue for Indian locale? Maybe (just a guess) because 
India is one of the few locales with a non-integer time difference from UCT?

Peter Clarke

On Saturday, 11 December 2021 at 02:15:15 UTC+9 [email protected] 
wrote:

> Hi,
>
> I'm using GRASS GIS 7.8 <https://grass.osgeo.org/>, an application 
> created using wxPython.
>
> Every time I try to open a dataset using this application, 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...
>
>
> Can someone please explain? How do I resolve this?
>
> Regards,
> Ishan
>

-- 
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/c4e68628-42b6-4429-9ca2-4f6a149f6b2cn%40googlegroups.com.

------=_Part_1451_231735221.1639264850696
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

I've seen a similar issue recently in my own code. When I started using wx.=
Locale, an unrelated part of the code started throwing this error. The spec=
ific line throwing the error creates the first instance of wx.Image. The on=
ly way I've found to resolve it so far is either (1) get rid of wx.Locale u=
sage completely, or (2) get rid of wx.Image usage. Not a pleasant choice.<d=
iv><br></div><div>I found the error was coming up on specific Windows machi=
nes only. I have not seen it on my own Windows or Mac. It first showed up o=
n my colleague's Windows PC - she's Indian. As the OP has a .in email addre=
ss, I wonder if it's a particular issue for Indian locale? Maybe (just a gu=
ess) because India is one of the few locales with a non-integer time differ=
ence from UCT?</div><div><br></div><div>Peter Clarke<br><br></div><div clas=
s=3D"gmail_quote"><div dir=3D"auto" class=3D"gmail_attr">On Saturday, 11 De=
cember 2021 at 02:15:15 UTC+9 [email protected] wrote:<br/></div><bl=
ockquote class=3D"gmail_quote" style=3D"margin: 0 0 0 0.8ex; border-left: 1=
px solid rgb(204, 204, 204); padding-left: 1ex;"><div>Hi,</div><div><br></d=
iv><div>I&#39;m using <a href=3D"https://grass.osgeo.org/" target=3D"_blank=
" rel=3D"nofollow" data-saferedirecturl=3D"https://www.google.com/url?hl=3D=
en-GB&amp;q=3Dhttps://grass.osgeo.org/&amp;source=3Dgmail&amp;ust=3D1639350=
294820000&amp;usg=3DAFQjCNGJJz1dfdMCjwW4xpuigT4fahI7rA">GRASS GIS 7.8</a>, =
an application created using wxPython.</div><div><br></div><div>Every time =
I try to open a dataset using this application, I get the following error:<=
/div><div>C:\Users\Ishan Buxy&gt;Traceback (most recent call last):<br>=C2=
=A0 File &quot;C:\Program Files\GRASS GIS 7.8\gui\wxpython\wxgui.py&quot;, =
line 105, in OnInit<br>=C2=A0 =C2=A0 mainframe =3D GMFrame(parent=3DNone, i=
d=3Dwx.ID_ANY,<br>=C2=A0 File &quot;C:\Program Files\GRASS GIS 7.8\gui\wxpy=
thon\lmgr\frame.py&quot;, line 141, in __init__<br>=C2=A0 =C2=A0 self._crea=
teMenuBar()<br>=C2=A0 File &quot;C:\Program Files\GRASS GIS 7.8\gui\wxpytho=
n\lmgr\frame.py&quot;, line 268, in _createMenuBar<br>=C2=A0 =C2=A0 self.me=
nubar =3D GMenu(<br>=C2=A0 File &quot;C:\Program Files\GRASS GIS 7.8\gui\wx=
python\gui_core\menu.py&quot;, line 47, in __init__<br>=C2=A0 =C2=A0 self.A=
ppend(self._createMenu(child), child.label)<br>=C2=A0 File &quot;C:\Program=
 Files\GRASS GIS 7.8\gui\wxpython\gui_core\menu.py&quot;, line 61, in _crea=
teMenu<br>=C2=A0 =C2=A0 self._createMenuItem(menu, label=3Dchild.label, **d=
ata)<br>=C2=A0 File &quot;C:\Program Files\GRASS GIS 7.8\gui\wxpython\gui_c=
ore\menu.py&quot;, line 88, in _createMenuItem<br>=C2=A0 =C2=A0 menuItem.Se=
tBitmap(MetaIcon(img=3Dicon).GetBitmap(self.bmpsize))<br>=C2=A0 File &quot;=
C:\Program Files\GRASS GIS 7.8\gui\wxpython\icons\icon.py&quot;, line 96, i=
n GetBitmap<br>=C2=A0 =C2=A0 image =3D wx.Image(name=3Dself.imagepath)<br>w=
x._core.wxAssertionError: C++ assertion &quot;strcmp(setlocale(0, 0), &quot=
;C&quot;) =3D=3D 0&quot; 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 us=
ing wxLocale and now there is a mismatch between C/C++ and Windows locale.<=
br>Things are going to break, please only change locale by creating wxLocal=
e objects to avoid this!<br>OnInit returned false, exiting...</div><div><br=
></div><div><br></div><div>Can someone please explain? How do I resolve thi=
s?<br></div><div><br></div><div>Regards,</div><div>Ishan<br></div></blockqu=
ote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;wxPython-users&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:[email protected]">wxpy=
[email protected]</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/d/msgid/wxpython-users/c4e68628-42b6-4429-9ca2-4f6a149f6b2cn%40googlegro=
ups.com?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.com/d=
/msgid/wxpython-users/c4e68628-42b6-4429-9ca2-4f6a149f6b2cn%40googlegroups.=
com</a>.<br />

------=_Part_1451_231735221.1639264850696--

------=_Part_1450_410409320.1639264850696--