Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

robotframework ride cannot be started with wxPython language problem #1481

Open
Racheljia1989 opened this issue Jan 10, 2020 · 6 comments
Open

Comments

@Racheljia1989
Copy link

Racheljia1989 commented Jan 10, 2020

Operating system: windows 7 X86_64
**wxPython version **: 4.0.7.post2
**Python version **: 3.8.1
**robotframework-ride version **: 1.7.4
Description of the problem: I'm a tester and wantto use robotframework to write autotest cases.I installed python of version 3.8.7 and wxPython of version 4.0.7.post2 on windows platform.When I clicked the robotframework-ride button to start robotframework-ride,it failed to start because of wxPython.Failling tips came out as follows:

wx._core.wxAssertionError: C++ assertion "strcmp(setlocale(LC_ALL, NULL), "C") =
= 0" failed at ..\..\src\common\intl.cpp(1579) in wxLocale::GetInfo(): **You proba
bly called setlocale() directly instead of using wxLocale and now there is a mis
match between C/C++ and Windows locale.
Things are going to break, please only change locale by creating wxLocale object
s to avoid this!**
OnInit returned false, exiting...
Error in atexit._run_exitfuncs:
wx._core.wxAssertionError: C++ assertion "GetEventHandler() == this" failed at .
.\..\src\common\wincmn.cpp(478) in wxWindowBase::~wxWindowBase(): any pushed eve
nt handlers must have been removed

I've tried to change the language of wxPython in file application.py to chinese-simplified which was english in default,but it still failed.

class RIDE(wx.App):

    def __init__(self, path=None, updatecheck=True):
        self._initial_path = path
        self._updatecheck = updatecheck
        context.APP = self
        wx.App.__init__(self, redirect=False)

    def OnInit(self):
        # DEBUG To test RTL
        #self._initial_locale = wx.Locale(wx.LANGUAGE_ARABIC)
        #self._initial_locale = wx.Locale(wx.LANGUAGE_ENGLISH)
        self._initial_locale = wx.Locale(wx.LANGUAGE_CHINESE_SIMPLIFIED)
        # Needed for SetToolTipString to work
        wx.HelpProvider.Set(wx.SimpleHelpProvider())  # TODO adjust to wx versions 
        self.settings = RideSettings()
        librarydatabase.initialize_database()
        self.preferences = Preferences(self.settings)
        self.namespace = Namespace(self.settings)
        self._controller = Project(self.namespace, self.settings)
        self.frame = RideFrame(self, self._controller)
        self._editor_provider = EditorProvider()
        self._plugin_loader = PluginLoader(self, self._get_plugin_dirs(),
                                           coreplugins.get_core_plugins())

At last,I commented all the self.__initial_local code and the robotframework-ride could be started.However it’s also abnormal.

So,my question is how to solve the wxPython language problem completely,guys?

@RobinD42
Copy link
Member

However it’s also abnormal.

In what way?

@HelioGuilherme66
Copy link
Contributor

@Racheljia1989 We have a warning in RIDE's project that it is not compatible with Python 3.8. However, the current development version already have a fix for it, so you should try to install that version.

pip install -U https://github.com/robotframework/RIDE/archive/master.zip

@Racheljia1989
Copy link
Author

@HelioGuilherme66 Thx a lot for ur answer,and I will try the new version later.

@cbeytas
Copy link
Contributor

cbeytas commented Mar 14, 2020

I also can't get RIDE to work. Similar error. Python 2.7.13 with wxPython 4.0.7.post2.

File "C:\Python27\lib\site-packages\robotide\ui\images.py", line 91, in _get_image
    img = wx.Image(path, wx.BITMAP_TYPE_PNG).ConvertToBitmap()
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!

@cbeytas
Copy link
Contributor

cbeytas commented Mar 14, 2020

Works with wxPython 4.0.3.

With wxPython 4.0.7 _initial_locale is set to a default locale with commit 6d77fcf. In the OnInit method calling wx.GetLocale() returns a valid "en_US" locale, which is the same object that is stored in self._initial_locale. But then this line tries to redefine self._initial_locale:

self._initial_locale = wx.Locale(wx.LANGUAGE_ENGLISH)

After this line calling wx.GetLocale() returns None. So somehow the act of changing _initial_locale is clearing the global locale. Possibly a race condition where the new locale is created, then the destructor of the initial locale (m_pOldLocale=null) clears the global locale?

@swt2c
Copy link
Collaborator

swt2c commented Jul 15, 2020

There will be a new version of InitLocale() in wxPython 4.1.1 which might fix this. Can you try one of the latest snapshot builds to see if the problem is resolved? https://wxpython.org/Phoenix/snapshot-builds/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants