Wxpython 3.0 interrupts old applications? (locale error)

I had an application that worked correctly with older versions of wxpython

Now that wxpython 3.0 when trying to start the application, I get the following error:

  File "C:\Python27\lib\site-packages\wx-3.0-msw\wx\_controls.py", line 6523, in __init__
    _controls_.DatePickerCtrl_swiginit(self,_controls_.new_DatePickerCtrl(*args, **kwargs))
wx._core.PyAssertionError: C++ assertion "strcmp(setlocale(LC_ALL, NULL), "C") == 0" failed at ..\..\src\common\intl.cpp(1449) 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!

an error occurs from this line

File "C:\Users\hadi\Dropbox\Projects\Python\dialysis\profile.py", line 159, in __init__
    style=wx.DP_DROPDOWN)

Help is much appreciated

+4
source share
2 answers

, , , , , , - . , , script - , , . , - . wxPython wx.Locale:

locale = wx.Locale(wx.LANGUAGE_ENGLISH)

, . , Locale . :

class MyApp(wx.App): ... def OnInit(self): self.locale = wx.Locale(wx.LANGUAGE_ENGLISH) ...

+14

. , wx.App:

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

:

:

..\..\src\common\intl.cpp(1449): assert "strcmp( setlocale(LC_ALL, NULL), "C")==0" failed in wxLocale::GetInfo() ...
0

Source: https://habr.com/ru/post/1524394/


All Articles