[TxMt] PyMate ignores first exception

Alex Ross alex.j.ross at gmail.com
Tue Dec 11 08:42:44 UTC 2007


> 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


More information about the textmate mailing list