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

demo files crashes with "wx._core.wxAssertionError" #1804

Closed
amaank404 opened this issue Sep 27, 2020 · 8 comments
Closed

demo files crashes with "wx._core.wxAssertionError" #1804

amaank404 opened this issue Sep 27, 2020 · 8 comments

Comments

@amaank404
Copy link

Operating system: Windows Home 10.0.15063 x64
wxPython version & source: pypi 4.1.0
Python version & source: python 3.8.3 official distribution

Description of the problem:

This happens when the extra demo file is run

D:\Xcodz\wxpython\wxPython-demo-4.1.0\demo>python __main__.py
Traceback (most recent call last):
  File "D:\Program Files\Python\Python38\lib\site-packages\wx\core.py", line 2311, in Notify
    self.notify()
  File "D:\Program Files\Python\Python38\lib\site-packages\wx\core.py", line 3508, in Notify
    self.result = self.callable(*self.args, **self.kwargs)
  File "D:\Xcodz\wxpython\wxPython-demo-4.1.0\demo\Main.py", line 2620, in ShowMain
    frame = wxPythonDemo(None, "wxPython: (A Demonstration)")
  File "D:\Xcodz\wxpython\wxPython-demo-4.1.0\demo\Main.py", line 1498, in __init__
    self.BuildMenuBar()
  File "D:\Xcodz\wxpython\wxPython-demo-4.1.0\demo\Main.py", line 1707, in BuildMenuBar
    item.SetBitmap(images.catalog['deletedocs'].GetBitmap())
  File "D:\Program Files\Python\Python38\lib\site-packages\wx\lib\embeddedimage.py", line 49, in GetBitmap
    return wx.Bitmap(self.GetImage())
  File "D:\Program Files\Python\Python38\lib\site-packages\wx\lib\embeddedimage.py", line 64, in GetImage
    return wx.Image(stream)
wx._core.wxAssertionError: C++ assertion "strcmp(setlocale(0, 0), "C") == 0" failed at ..\..\src\common\intl.cpp(1699) 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!
@tatarize
Copy link

I've hit this crash in the wild with Windows 10, Python 3.8 and wxpython 4.10 Google search hit this. It's not just the demo being screwy. I'd like a work around.

@tatarize
Copy link

Apparently in windows that was Croatian with the language set to English it crashed. I'm thinking maybe the C++ took the language from one place and Widgets took the language from another place. Since I cooked up a version of this that ripped out all the internationalization for a user and it still crashed for him.

@Metallicow
Copy link
Contributor

@tatarize @xcodz-dot You might want to try out a snapshot build...
@kdschlosser and @RobinD42 have been working on a fix. About the only thing I had figured out was that it was related to Python3.8 and IIRC it was found to be a mismatch with strings or somesuch.
You might look here #1616 also.
There are numerous issues folks have made about this and it kind of bewildered us for a good bit of time. Some even thought it had to do with images/etc...

wxPy 4.1 was a bit of a rocky release because Robin basically took a flying leap into the wxWidgets bleeding edge. And with wxPy 4.1 there are other things such as event changes/fixes on the wxWidgets side that may cause alot of folks python programs to error, have performance issues or widgets may stop working. Those that do locale stuff are testing atm so it might be better for you to stay at wxPy4.0 until 4.1.next is released or go ahead and try to work with each other to figure out if all the problems have been smoothed out.

@tatarize
Copy link

I've had two reports of the crash but I basically ruled out everything on my end, and I can't duplicate it myself to figure out a good work around. I ripped out all my internationalization code and it still weirdly crashed there. I tested Portuguese windows in English and German, and couldn't get it to crash. I'm guessing native Croatian windows into English triggers is a trigger, but I don't have access to Croatian windows. --- I'll give 4.0 a shot and cook it up for the guy who has the crash. And see. It at least gives me a way forward.

@Metallicow
Copy link
Contributor

The latest snapshots can be downloaded here.
https://wxpython.org/Phoenix/snapshot-builds/
And since you are using windows, you will probably want to install
wxPy4.0 into a sitepackages directory named wx-4.0.x-msw-phoenix
and the latest snapshot into a directory named wx-4.1.x-msw
and create a wx.pth file and use my hotswapper here to flip flop between versions inbetween restarts.
https://github.com/Metallicow/wxpthVersionSwitcher
You may need to edit the wxpthSwitcher program depending on how you like the directories to be named. and or change from Python2/3.

@amaank404
Copy link
Author

Well, thank you. I just wanted to start with a GUI library and thought i could go with this but no problems for me cause i have other options to try to learn (Anyway, thanks for guidance @Metallicow )

@tatarize
Copy link

@Metallicow the guy I know who gets this error got it with wx-python 4.0 too.
wxPython 4.0.7

@Metallicow
Copy link
Contributor

@tatarize @xcodz-dot
I said the problem was with python 3.8
I guess I should have better stated for you to use python 3.7 and wxPy4.0 until the next 4.1.x comes out if and when you want to revisit testing. Otherwise use a snapshot and try to work with the others having these i18n issues.
Some users who just pip wxpython might also not be aware that an odd dot release is considered unstable in wxWidgets/wxPython. Ex: 4.1, 3.1, 2.9, 2.7
"Stable" releases would be Ex: 2.8, 3.0, 4.0

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

3 participants