benjie-git / CardStock

CardStock is a cross-platform tool for quickly and easily building programs. It provides a drawing-program-like editor for visually laying out your programs' parts, and a code editor for adding event-driven python code.
Mozilla Public License 2.0
249 stars 9 forks source link

BUG: Locale error #2

Closed unendiverse closed 3 years ago

unendiverse commented 3 years ago

The program (pyinstaller version) does not open a window. The process is running but there are no open windows. OS: Windows 10 build 1909

unendiverse commented 3 years ago

Just found out the source code version gives a traceback:

Traceback (most recent call last): File "C:\Users\-----\Downloads\CardStock\designer.py", line 823, in OnInit self.frame = DesignerFrame(None) File "C:\Users\-----\Downloads\CardStock\designer.py", line 90, in __init__ toolbar.AddTool(ID_RUN, 'Run', wx.ArtProvider.GetBitmap(wx.ART_FULL_SCREEN), wx.NullBitmap) wx._core.wxAssertionError: C++ assertion "strcmp(setlocale(0, 0), "C") == 0" failed at ..\..\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...

benjie-git commented 3 years ago

This hasn't happened on any of my test machines. I'll research this...

benjie-git commented 3 years ago

Can you test again after this commit? https://github.com/benjie-git/CardStock/commit/16c5e25866a69cbeb76916ff08e64a97292acc80

unendiverse commented 3 years ago

Still: Traceback (most recent call last): File "C:\Users\-----\Downloads\CardStock-16c5e25866a69cbeb76916ff08e64a97292acc80\designer.py", line 718, in OnInit self.frame = DesignerFrame(None) File "C:\Users\-----\Downloads\CardStock-16c5e25866a69cbeb76916ff08e64a97292acc80\designer.py", line 83, in __init__ toolbar.AddTool(ID_RUN, 'Run', wx.ArtProvider.GetBitmap(wx.ART_FULL_SCREEN), wx.NullBitmap) wx._core.wxAssertionError: C++ assertion "strcmp(setlocale(0, 0), "C") == 0" failed at ..\..\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.

benjie-git commented 3 years ago

Hello again, I'm about to release the next CardStock version, which brings many improvements, including exporting a stack to a standalone application. I also added what I think will be a fix for your locale crash. Are you able to grab the latest from git, and try again? (I have been unable to reproduce the problem, so I can't test it myself.)

benjie-git commented 3 years ago

I just released v0.8.4, which I think may fix this problem. I'd love getting your help to confirm this, and if it's not fixed, then I'll have more questions for you to narrow it down!

benjie-git commented 3 years ago

Apparently libpng spews out some png-related errors, and tries to localize them. newer versions of python handle locales differently than wxPython expects, and everything blows up.

I was finally able to recreate this bug by setting my Windows machine to Azerbaijani, with no English fallback. I was then able to see the errors, and work around them.

The fix is in master now, and will be in v0.8.6, releasing shortly.