Why does this extremely simple wxPython AUI application crash on launch?
Question: I'm making a Regular Expression testing tool for work. I would like it to be a
simple AUI application, but after transferring what seems to me to be the
**core** of an AUI application from the demo to my code, it crashes on
startup. I can only see the wxPython log window for a fraction of a second
before it disappears, and the code produces no errors in the console.

Here is the troublesome frame. If I comment out all the `_mgr` lines, the
application runs just fine.

    
    
    class RegexTesterFrame(wx.Frame):
        def __init__(self):
            wx.Frame.__init__(
                self, None, -1, 'Regex tester', (100, 100),
                (400, 400), wx.DEFAULT_FRAME_STYLE
            )
    
            self.initialize_components()
            self.CreateStatusBar()
    
        def initialize_components(self):
            self._mgr = wx.aui.AuiManager()
            self._mgr.SetManagedWindow(self)
    
            self._perspectives = []
    
            self._mgr.AddPane(
                wx.CheckBox(self, -1, 'test'),
                wx.aui.AuiPaneInfo().Name('Test pane').Caption('Test caption').Top()
            )
    
            self._mgr.Update()
    
            self.Bind(wx.EVT_CLOSE, self.on_close)
    
        def on_close(self, event):
            self._mgr.UnInit()
            del self._mgr
            self.Destroy()
    

Here is the full code (~100 lines): <http://pastebin.com/xZS2g1fq>

And here is the demo I'm working from (LARGE): <http://pastebin.com/G26BMYZx>

I'm curious about two things - why does the application crash, and why do I
get no error output when wxPython applications crash in general.


Answer: I've struggled with this since yesterday, but as usual, the minute I ask the
question on StackOverflow I figure it out. First of all I got the application
to output error information in a message box instead of stderr:

    
    
    def main():
        try:
            app = RegexTesterApp(True)
            app.MainLoop()
        except:
            import traceback
            xc = traceback.format_exception(*sys.exc_info())
            wx.MessageBox(''.join(xc))
    

Then the error revealed that `wx.aui` was a module that I hadn't imported.
Importing it fixed the crash.

