[wingide-users] Wing IDE Pro trace back error but not on Eclipse/Pydev

Mike Driscoll mdriscoll at co.marshall.ia.us
Mon Jul 14 13:14:56 MDT 2008


Devl Infonews wrote:
> Hi,
>
> I am just learning Python and wxPython.  Meanwhile I am also trying 
> out Wing IDE Pro and Eclipse/Pydev and running through some of the 
> example off of Noel Rappin's book wxPython in Action.  The problem is 
> I get the trace back error on Wing IDE but not on the Eclipse/Pydev 
> IDE.  Here is the code that simply tells the apps to redirect stdout 
> and stderr:
>
> #!/usr/bin/env python
>
> import wx
> import sys
>
> class Frame(wx.Frame):
>     def __init__(self, parent, id, title):
>         print "Frame __init__"
>         wx.Frame.__init__(self, parent, id, title)
> class App(wx.App):
>     def __init__(self, redirect=True, filename=None):
>         print "App __init__"
>         wx.App.__init__(self, redirect, filename)
>     def OnInit(self):
>         print "OnInit"
>         self.frame = Frame(parent=None, id=-1, title='Startup')
>         self.frame.Show()
>         self.SetTopWindow(self.frame)
>         print >> sys.stderr, "A pretend error message"
>         return True
>     def OnExit(self):
>         print "OnExit"
>
> if __name__ == '__main__':
>     app = App(redirect=True)
>     print "before MainLoop"
>     app.MainLoop()
>     print "after MainLoop"
>
> The error occurs when I close the last window.  Wing points me to 
> _windows.py on line 505.  The trace back message is:
>
> TypeError: in method 'new_Frame', expected argument 1 of type 'wxWindow *'
> File "..../
> File "/Users/melton/work/Python/wxPython/Stdout-redirect.py", line 27, 
> in <module>
>   app.MainLoop()
> File 
> "//usr/local/lib/wxPython-ansi-2.8.8.0/lib/python2.5/site-packages/wx-2.8-mac-ansi/wx/_core.py", 
> line 7941, in MainLoop
>   wx.PyApp.MainLoop(self)
> File 
> "//usr/local/lib/wxPython-ansi-2.8.8.0/lib/python2.5/site-packages/wx-2.8-mac-ansi/wx/_core.py", 
> line 7267, in MainLoop
>   return _core_.PyApp_MainLoop(*args, **kwargs)
> File "/Users/melton/work/Python/wxPython/Stdout-redirect.py", line 22, 
> in OnExit
>   print "OnExit"
> File 
> "//usr/local/lib/wxPython-ansi-2.8.8.0/lib/python2.5/site-packages/wx-2.8-mac-ansi/wx/_core.py", 
> line 7774, in write
>   self.CreateOutputWindow(text)
> File 
> "//usr/local/lib/wxPython-ansi-2.8.8.0/lib/python2.5/site-packages/wx-2.8-mac-ansi/wx/_core.py", 
> line 7748, in CreateOutputWindow
>   style=wx.DEFAULT_FRAME_STYLE)
> File 
> "//usr/local/lib/wxPython-ansi-2.8.8.0/lib/python2.5/site-packages/wx-2.8-mac-ansi/wx/_windows.py", 
> line 505, in __init__
>   _windows_.Frame_swiginit(self,_windows_.new_Frame(*args, **kwargs))
>
> Why does it occur on Wing and not on Eclipse/Pydev?  I would be very 
> happy with Wing IDE If this is a wxPython error that it caught.
>
> My environment:
> PowerPC Mac OS X 10.4.11
> Python 2.5.2 - MacPython distribution from from python.org 
> <http://python.org>
> wxPython 2.8.8.0 <http://2.8.8.0>
> Wing IDE Pro 3.1.2-1
> Eclipse 3.4
> Pydev 1.3.18
>
>
> Mel

This runs fine on my Windows XP box from Wing Pro 3.1.2-1, wxPython 
2.8.8.0, Python 2.5. I only see the error when I close it. The code 
looks correct though. It seems to be stemming from the redirected text 
frame when it is closed. This is probably due to the fact that the 
original frame was closed before it was. My guess is that the wx.App 
object is a parent of some sort for the redirect frame and when you 
close the app BEFORE the redirect, you end up with an error.

You should probably post to the wxPython user's group about it, although 
I think it's harmless.

Mike


More information about the wingide-users mailing list