I just tracked down a bug that causes Python to quit with a "bus error" message. This seems to only be a problem when running under OS X; under Windows and Gtk, the code executes normally.
I am enclosing code to reproduce this problem. I am running wxPython 2.5.2.8 under OS X 10.3.8, with Python 2.3.4.
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
import wx
class WxDemoFrame(wx.Frame):
def __init__(self, parent, id):
super(WxDemoFrame, self).__init__(parent=parent, id=id)
self.SetSize((300, 400))
self.lb = wx.ListBox(self, -1)
btn = wx.Button(self, -1)
btn.SetLabel("Click to crash under OS X")
btn.Bind(wx.EVT_BUTTON, self.onClick)
sz = wx.BoxSizer(wx.VERTICAL)
sz.Add(self.lb)
sz.Add(btn)
self.SetSizer(sz)
self.Layout()
def onClick(self, evt):
""" There should be no items in the list now.
Calling GetString(0) will crash on OS X, even in
a try block.
"""
try:
val = self.lb.GetString(0)
except:
print "No such index"
if __name__ == '__main__':
app = wx.PySimpleApp()
frm = WxDemoFrame(None, -1)
frm.Show(1)
app.MainLoop()
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
___/
/
__/
/
____/
Ed Leafe
http://leafe.com/
http://dabodev.com/
Come to PyCon!!!! http://www.python.org/pycon/2005/