wxPython is unrunnable due to 'locale error'

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

wxPython is unrunnable due to 'locale error'

Michael Rosen
Whenever I try to run a wxPython file, it refuses to run, and says:

Traceback (most recent call last):
  File "C:\Users\michael\Work\Aesthetic.py", line 54, in <module>
    frame = TestFrame(None)
  File "C:\Users\michael\Work\Aesthetic.py", line 7, in __init__
    aestheticgui.MyFrame3.__init__(self, parent)
  File "C:\Users\michael\Work\aestheticgui.py", line 29, in __init__
    self.m_bitmap3 = wx.StaticBitmap( self, wx.ID_ANY, wx.Bitmap( u"ModFaceMatchIntroScreenLowRes.png", wx.BITMAP_TYPE_ANY ), wx.DefaultPosition, wx.DefaultSize, 0 )
wx._core.wxAssertionError: C++ assertion "strcmp(setlocale(LC_ALL, NULL), "C") == 0" failed at ..\..\src\common\intl.cpp(1579) 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!

I read before that changing the locale in the init would work, but it hasn't made any difference.

Code here:

import wx
import aestheticgui
import locale

class TestFrame(aestheticgui.MyFrame3):
    def __init__(self, parent):
        aestheticgui.MyFrame3.__init__(self, parent)
        self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)

app = wx.App(False)
frame = TestFrame(None)
frame.Show(True)

print("DEBUG:", wx.GetDisplaySize().GetWidth(), wx.GetDisplaySize().GetHeight())

frame.SetSize(wx.GetDisplaySize().GetWidth(), wx.GetDisplaySize().GetHeight())
frame.Centre()

app.MainLoop()



--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: wxPython is unrunnable due to 'locale error'

Igor Korot
Hi,

On Fri, Sep 1, 2017 at 11:52 PM, Michael Rosen
<[hidden email]> wrote:
> Whenever I try to run a wxPython file, it refuses to run, and says:

What version of python/wxPython do you use?
What is you Windows locale settings? Are you running US version?

Thank you.

>
> Traceback (most recent call last):
>   File "C:\Users\michael\Work\Aesthetic.py", line 54, in <module>
>     frame = TestFrame(None)
>   File "C:\Users\michael\Work\Aesthetic.py", line 7, in __init__
>     aestheticgui.MyFrame3.__init__(self, parent)
>   File "C:\Users\michael\Work\aestheticgui.py", line 29, in __init__
>     self.m_bitmap3 = wx.StaticBitmap( self, wx.ID_ANY, wx.Bitmap(
> u"ModFaceMatchIntroScreenLowRes.png", wx.BITMAP_TYPE_ANY ),
> wx.DefaultPosition, wx.DefaultSize, 0 )
> wx._core.wxAssertionError: C++ assertion "strcmp(setlocale(LC_ALL, NULL),
> "C") == 0" failed at ..\..\src\common\intl.cpp(1579) 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!
>
> I read before that changing the locale in the init would work, but it hasn't
> made any difference.
>
> Code here:
>
> import wx
> import aestheticgui
> import locale
>
> class TestFrame(aestheticgui.MyFrame3):
>     def __init__(self, parent):
>         aestheticgui.MyFrame3.__init__(self, parent)
>         self.locale = wx.Locale(wx.LANGUAGE_ENGLISH)
>
> app = wx.App(False)
> frame = TestFrame(None)
> frame.Show(True)
>
> print("DEBUG:", wx.GetDisplaySize().GetWidth(),
> wx.GetDisplaySize().GetHeight())
>
> frame.SetSize(wx.GetDisplaySize().GetWidth(),
> wx.GetDisplaySize().GetHeight())
> frame.Centre()
>
> app.MainLoop()
>
>
>
> --
> 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 [hidden email].
> For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: wxPython is unrunnable due to 'locale error'

Robin Dunn

On Saturday, September 2, 2017 at 7:04:00 AM UTC-7, Igor Korot wrote:
Hi,

On Fri, Sep 1, 2017 at 11:52 PM, Michael Rosen
<[hidden email]> wrote:
> Whenever I try to run a wxPython file, it refuses to run, and says:

What version of python/wxPython do you use?
What is you Windows locale settings? Are you running US version?


It may also help to know the native locale of the Windows system. And does it make any differences if you change it?
 
--
Robin Dunn
Software Craftsman
http://wxPython.org
 

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: wxPython is unrunnable due to 'locale error'

Robin Dunn


On Saturday, September 2, 2017 at 11:49:35 AM UTC-7, Robin Dunn wrote:

On Saturday, September 2, 2017 at 7:04:00 AM UTC-7, Igor Korot wrote:
Hi,

On Fri, Sep 1, 2017 at 11:52 PM, Michael Rosen
<[hidden email]> wrote:
> Whenever I try to run a wxPython file, it refuses to run, and says:

What version of python/wxPython do you use?
What is you Windows locale settings? Are you running US version?


It may also help to know the native locale of the Windows system. And does it make any differences if you change it?
 

Oops, I should have actually read Igor's pose instead of just skimming it with half an eyeball ;-) Thanks Igor.
 
--
Robin Dunn
Software Craftsman
http://wxPython.org

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: wxPython is unrunnable due to 'locale error'

Tim Roberts
In reply to this post by Michael Rosen

On Sep 1, 2017, at 8:52 PM, Michael Rosen <[hidden email]> wrote:

Whenever I try to run a wxPython file, it refuses to run, and says:

Traceback (most recent call last):
  File "C:\Users\michael\Work\Aesthetic.py", line 54, in <module>
    frame = TestFrame(None)
  File "C:\Users\michael\Work\Aesthetic.py", line 7, in __init__
    aestheticgui.MyFrame3.__init__(self, parent)
  File "C:\Users\michael\Work\aestheticgui.py", line 29, in __init__
    self.m_bitmap3 = wx.StaticBitmap( self, wx.ID_ANY, wx.Bitmap( u"ModFaceMatchIntroScreenLowRes.png", wx.BITMAP_TYPE_ANY ), wx.DefaultPosition, wx.DefaultSize, 0 )
wx._core.wxAssertionError: C++ assertion "strcmp(setlocale(LC_ALL, NULL), "C") == 0" failed at ..\..\src\common\intl.cpp(1579) 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!

I read before that changing the locale in the init would work, but it hasn't made any difference.

Yes, but the failure happens within the call to aestheticgui.MyFrame3.__init__, and you didn't change the locale until after that call.  Swap the orders.
— 
Tim Roberts, [hidden email]
Providenza & Boekelheide, Inc.

--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.