Hi,
I started using wxPython lately and am a little surprised by PyMate's reaction to exceptions. Try this:
#!/usr/bin/env python import wx
def OnRaiseException(e): raise "See?"
app = wx.PySimpleApp() frame = wx.Frame(None, wx.ID_ANY, "Hello World")
button = wx.Button(frame, 100, "Raise Exception") wx.EVT_BUTTON(button, 100, OnRaiseException)
frame.Show(True) app.MainLoop()
Only on the second button click the traceback reaches PyMate:
Error in sys.excepthook: Traceback (most recent call last): method tm_excepthook in sitecustomize.py at line 66 io = fdopen(error_fd, 'w') OSError: [Errno 9] Bad file descriptor
Original exception was: Traceback (most recent call last): method OnRaiseException in test.py at line 5 raise "See?" See?
Perhaps someone can tell me whether this is a bug or a feature.
Regards,
Daniel
I started using wxPython lately and am a little surprised by PyMate's reaction to exceptions. Try this:
#!/usr/bin/env python import wx
def OnRaiseException(e): raise "See?"
app = wx.PySimpleApp() frame = wx.Frame(None, wx.ID_ANY, "Hello World")
button = wx.Button(frame, 100, "Raise Exception") wx.EVT_BUTTON(button, 100, OnRaiseException)
frame.Show(True) app.MainLoop()
Only on the second button click the traceback reaches PyMate:
Error in sys.excepthook: Traceback (most recent call last): method tm_excepthook in sitecustomize.py at line 66 io = fdopen(error_fd, 'w') OSError: [Errno 9] Bad file descriptor
Original exception was: Traceback (most recent call last): method OnRaiseException in test.py at line 5 raise "See?" See?
Perhaps someone can tell me whether this is a bug or a feature.
I think this is actually a “feature” of wx. Try running this program from the terminal. When you click the button, the exception is just written to STDERR... the process does not halt. This thread has some more information on what's going on here...
http://www.nabble.com/Catch-all-exception-handler-in-wxpython-to8738249.html
Only on the second button click the traceback reaches PyMate:
Error in sys.excepthook: Traceback (most recent call last): method tm_excepthook in sitecustomize.py at line 66 io = fdopen(error_fd, 'w') OSError: [Errno 9] Bad file descriptor
Original exception was: Traceback (most recent call last): method OnRaiseException in test.py at line 5 raise "See?" See?
Perhaps someone can tell me whether this is a bug or a feature.
I think this is actually a “feature” of wx. Try running this program from the terminal. When you click the button, the exception is just written to STDERR... the process does not halt. This thread has some more information on what's going on here...
But isn't the first exception from TextMate, not wxPython? It doesn't show when I run the program from the console. And it doesn't show again, so it isn't part of every exception.
http://www.nabble.com/Catch-all-exception-handler-in-wxpython- to8738249.html
The thread starter's problem was about wxPython exceptions not showing at all, so I do not quite see the connection. PyMate sees every exception - except the first one.
To me it still looks like PyMate is running into some problem when it makes its first contact with wxPython.