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

Packaged wxPython Hello-World crashes on macOS #2355

Closed
marcelstoer opened this issue Jan 5, 2017 · 10 comments
Closed

Packaged wxPython Hello-World crashes on macOS #2355

marcelstoer opened this issue Jan 5, 2017 · 10 comments
Labels
solution:works for me

Comments

@marcelstoer
Copy link

@marcelstoer marcelstoer commented Jan 5, 2017

Running a simple (windowed) wxPython Hello-World on macOS fails. It succeeds on Linux and on Windows (tested on Win7).

Environment

PyInstaller: tested with both 3.2 and 3.3.dev0+8892e11 (pip install/uninstall)
Python: 2.7.12
wxPython: 3.0.2.0 osx-cocoa
OS: macOS Sierra 10.12.2

Runtime error

./src/common/stdpbase.cpp(62): assert "traits" failed in Get(): create wxApp before calling this

stdpbase.cpp:62 is this

wxStandardPaths& wxStandardPathsBase::Get()
{
    wxAppTraits * const traits = wxTheApp ? wxTheApp->GetTraits() : NULL;
    wxCHECK_MSG( traits, gs_stdPaths, wxT("create wxApp before calling this") ); // <-- line 62

    return traits->GetStandardPaths();
}

"Something" (not my app code) is trying to use wx.StandardPaths before the App object has been created, which is no longer allowed since version 2.8.

Example program

#!/usr/bin/env python
import wx

app = wx.App(False)  # Create a new app, don't redirect stdout/stderr to a window.
frame = wx.Frame(None, wx.ID_ANY, "Hello World") # A Frame is a top-level window.
frame.Show(True)     # Show the frame.
app.MainLoop()

Source: https://wiki.wxpython.org/Getting%20Started#A_First_Application:_.22Hello.2C_World.22

Build command

pyinstaller -F --windowed hello-world.py

Note

I first discussed this in the wxPython community until we confirmed that it doesn't look like an issue with wxPython but with PyInstaller.

@marcelstoer marcelstoer changed the title Packaged wxPython app on macOS crashes with Packaged wxPython Hello-World crashes on macOS crashes Jan 5, 2017
@marcelstoer marcelstoer changed the title Packaged wxPython Hello-World crashes on macOS crashes Packaged wxPython Hello-World crashes on macOS Jan 5, 2017
@LtMerlin
Copy link

@LtMerlin LtMerlin commented Jan 6, 2017

Same problem here on the same system specs. Getting the same error:

...
./src/common/stdpbase.cpp(62): assert "traits" failed in Get(): create wxApp before calling this
Segmentation fault: 11

also occurs using Python 3.5.2

@marcelstoer
Copy link
Author

@marcelstoer marcelstoer commented Jan 13, 2017

@htgoebel et.al. is there any more info you need before this can be flagged as a confirmed bug? Is there a way for me to trace back where the call to stdpbase.cpp:62 comes from?

@sctigercat1
Copy link

@sctigercat1 sctigercat1 commented Jan 15, 2017

Can confirm that I'm also getting the same error on the same specs-

(..)
./src/common/stdpbase.cpp(62): assert "traits" failed in Get(): create wxApp before calling this
Segmentation fault: 11

@marcelstoer
Copy link
Author

@marcelstoer marcelstoer commented Jan 17, 2017

Not that I expected any difference but for the record: 3.2.1 shows this as well. If specific wxPython know-how is required to fix this maybe the experts @RobinD42 or @driscollis could provide that.

@ghost
Copy link

@ghost ghost commented Jan 17, 2017

@marcelstoer You would need a c debugger. See this question for more details on that.

@marcelstoer
Copy link
Author

@marcelstoer marcelstoer commented Feb 4, 2017

Can I suggest to add the v3.2, v3.2.1, and OS X tags here.

@xoviat I'm not sure how relevant that SO question is for folks on macOS. I reckon Apple's article on working with the LLDB is a more helpful resource? However, so far I haven't been able to set the correct break point obviously as the execution doesn't stop before it fails. For starters one would essentially just need a break point that catches all errors and then dump the call stack.
I tried break set -E C++, breakpoint set --selector __cxa_throw:, breakpoint set --selector wxStandardPathsBase:, breakpoint set --file ./src/common/stdpbase.cpp --line 62 and a few variants but nope, doesn't stop.

@ghost
Copy link

@ghost ghost commented Feb 4, 2017

@marcelstoer Does the following work?

b main

@marcelstoer
Copy link
Author

@marcelstoer marcelstoer commented Feb 4, 2017

Setting works but execution doesn't stop.
b Get (aimed at wxStandardPathsBase::Get()) is fine and execution does stop - very early though in LaunchServices CSStore2::Store::Get()

@ghost
Copy link

@ghost ghost commented Feb 4, 2017

Once you have stopped it, you should be able to use thread until to get to where you want. If I'm lucky.

@marcelstoer
Copy link
Author

@marcelstoer marcelstoer commented Feb 17, 2017

@htgoebel @xoviat I'm afraid I can't help any further with analysis - no surprise given how little I know about PyInstaller. I was helped on Stack Overflow specifically with this "debugging with LLDB" issue (http://stackoverflow.com/q/42065547/131929). However, the conclusion was that the binary was stripped although my .spec file says strip=False.

@solancer
Copy link

@solancer solancer commented Mar 12, 2017

I'm affected by this too, is there any progress on this?

@dbpodrasky
Copy link

@dbpodrasky dbpodrasky commented Apr 4, 2017

Second that. Hey PyInstaller folks, this makes PyInstaller useless on Mac OS and I'll I'm hearing is crickets.

@ghost
Copy link

@ghost ghost commented Apr 4, 2017

Second that. Hey PyInstaller folks, this makes PyInstaller useless on Mac OS and I'll I'm hearing is crickets.

The fact is that there is no one who has time, is a Mac expert, and who works on pyinstaller. I run Windows and Linux. I have fixed a few issues by piecing together how things work using Travis ci osx. However, this problem needs a Mac expert.

@marcelstoer
Copy link
Author

@marcelstoer marcelstoer commented Feb 10, 2018

I'm closing it as there's no indication the maintainers can/are willing to fix it. Using the latest PyInstaller with the recently released wxPython 4.x does NOT show this behavior.

@htgoebel htgoebel added the solution:works for me label Sep 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
solution:works for me
Projects
None yet
Development

No branches or pull requests

6 participants