Attribute Error when debugging wxPython scrip

Help
2012-11-04
2013-05-01
  • Patrick Dickey
    Patrick Dickey
    2012-11-04

    Hi everyone,

    I created a wxPython app in Boa Constructor, but when I try running it, nothing happens. If I try debugging it, I get "AttributeError: TransportWithAuth instance has no attribute '_connection'." with the option to stop the debugger. Googling this doesn't come up with any useful information. I'm running Boa Constructor on Ubuntu 12.10 x64, but it was also happening on Ubuntu 12.04 x64.

    Here's the source from my wxApp file (and I should note that all of the other files are listed correctly in the Application Tab)

    1
    2
    3
    4
    5
    6
    7
    #!/usr/bin/env python
    #Boa:PyApp:main
    modules ={u'frmAbout': [0, '', u'frmAbout.py'], u'frmMain': [0, '', u'frmMain.py']}
    def main():
        pass
    if __name__ == '__main__':
        main()
    

    Any help is greatly appreciated. And I'll be happy to post any additional code that you need.

    Have a great day:)
    Patrick.

     
  • Patrick Dickey
    Patrick Dickey
    2012-11-04

    A little addition to this question. Since the wxApp just has pass for the main() module, do I need a runner module in the wxFrame? I don't have one currently. I'm asking because I just watched a tutorial where the creator put on in. He didn't use wxApp to start with (only wxFrame) though.

    Have a great day:)
    Patrick.

     
  • Hi Patrick,

    You created a pyApp, in other words used the first icon, but for you want a wxApp, the fifth icon.

    That will create a "main" function similar to this:

    def main():
        # redirect has to be set to 0 otherwise we get strange crashes on e.g. Windows 7 64 bit
        appl = BoaApp(redirect=0)
        appl.MainLoop()

    and an application class in my case called BoaApp.

    Hope that helps
    Werner

     
  • Patrick Dickey
    Patrick Dickey
    2012-11-05

    Odd, I could have sworn that I clicked on wxApp. Maybe I clicked the wrong one and deleted the wrong one later on. So, could I just copy your code (and change it to mine)?

    Something like

    def main():
            # Redirect has to be set to 0 otherwise we get strange results on e.g. Windows 7 64 bit
            appl = TunnelBroker(redirect=0)
            appl.MainLoop()
    

    or do I need to add something to the frmMain.py program also?

    Thanks, and have a great day:)
    Patrick.

     
  • Patrick,

    TunnelBroker would need to be a class based on wx.App etc etc.

    The easiest is just to create a wxApp and then compare the two files it generates with what you have, or to copy past stuff from your existing files into the two files.

    Werner

     
  • Patrick Dickey
    Patrick Dickey
    2012-11-05

    Thanks again Werner. If I'm understanding correctly, I can create a new project (a wxApp) and copy and paste everything from inside Frame1 into the new Frame1 (by this I mean everything inside of "Class Frame1" from my current version). I would have to name the classes the same (frmMain.py and frmAbout.py).

    As an aside to this, is there an "About box" template somewhere? Or do I just need to create another wxFrame (or wxDialog)?

    Have a great day.:)
    Patrick.

     
  • Hi Patrick,

    A good resource to check out is the wxPython demo, it has a wx.AboutBox.

    Other things to check out are:
    http://showmedo.com/videotutorials/series?name=wKQrywla5  a bit dated but still very useful

    There is somewhere a page explaining how to use "standard" wxPython code in Boa, but can't find it for the moment, maybe someone else can provide the link and or tips.

    Werner