I notices elsewhere in that thread that someone using wxPython (who was
generally positive about it), was reporting hard crashes fairly frequently.
That was probably me you are referring to. I get them every few weeks.
Not quite weekly, but I'm sure it's happened dozens of times in the
past 6 months. It seems like wxPython doesn't do a lot of argument
checking. If it requires a Window it assumes it gets a Window, etc. At
least it seems that way to me.
wxPython does check parameter types as far as it is able to with the information given about what the the C++ function/method call is expecting. For example:
>>> s = wx.BoxSizer()
>>> w = wx.Frame(s)
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "/usr/local/lib/wxPython-2.9.1.1/lib/python2.6/site-packages/wx-2.9.1-osx_carbon/wx/_windows.py", line 575, in __init__
_windows_.Frame_swiginit(self,_windows_.new_Frame(*args, **kwargs))
TypeError: in method 'new_Frame', expected argument 1 of type 'wxWindow *'
>>>
What it's not able to do as much of is to ensure that things are used correctly. wxWidgets does have a lot of assertion and similar statements that check for those kinds of things, but if you are on linux and are using wx packages from your distro provider then odds are that they have not turned on the runtime assertions when the wx libraries were built. You can check for sure by looking at wx.PlatformInfo. Here is the one from the Ubuntu packages:
>>> import wx
>>> wx.PlatformInfo
('__WXGTK__', 'wxGTK', 'unicode', 'gtk2', 'wx-assertions-off', 'SWIG-1.3.29')
>>>
And here is one built in my current wxPython workspace:
>>> import wx
>>> wx.PlatformInfo
('__WXGTK__', 'wxGTK', 'unicode', 'gtk2', 'wx-assertions-on', 'SWIG-1.3.29')
>>>
When the assertions are turned on then wxPython is able to catch them and raise them as Python exceptions that will usually help you figure out what you did wrong. Otherwise the wx code will usually just continue on doing the thing that the assertion would have warned is a bad thing to do, which can lead to a segfault. If you are using Linux as your primary development system then I strongly recommend that while in development and testing phases you either use the debug wx and wxPython packages if yoiur distro provides them, or build your own set of wxWidgets and wxPython binaries and adjust your PYTHONPATH and LD_LIBRARY_PATH to use that copy while in develop/test mode.
···
On 1/25/11 9:57 AM, Bryan Oakley wrote:
On Tue, Jan 25, 2011 at 11:32 AM, Christopher Barker > <Chris.Barker@noaa.gov> wrote:
--
Robin Dunn
Software Craftsman