Weird MessageBox error

Hi,

A Task Coach user is reporting this traceback:

Traceback (most recent call last):
  File "taskcoach.pyw", line 22, in <module>
  File "taskcoach.pyo", line 42, in start
  File "taskcoachlib\application\application.pyo", line 38, in __init__
  File "taskcoachlib\application\application.pyo", line 84, in init
  File "taskcoachlib\application\application.pyo", line 96, in
warnUserThatIniFileWasNotLoaded
  File "wx\_misc.pyo", line 493, in MessageBox
wx._core.PyAssertionError: C++ assertion "wxAssertFailure" failed at
..\..\src\msw\msgdlg.cpp(137) in wxMessageDialog::ShowModal():
unexpected ::MessageBox() return code

The call to wx.MessageBox looks like this:

wx.MessageBox(\
            _("Couldn't load settings from TaskCoach.ini:\n%s")%reason,
            _('%s file error')%meta.name, style=wx.ICON_ERROR)

First I thought that showing the MessageBox before showing the main
window could be the issue, but this little program works as expected:

import wx

class Frame(wx.Frame):
    def __init__(self):
        wx.MessageBox('test', 'test')
        super(Frame, self).__init__(None)

app = wx.App(0)
frame = Frame()
frame.Show()
app.MainLoop()

Any ideas?

Thanks, Frank

Frank Niessink wrote:

Hi,

A Task Coach user is reporting this traceback:

Traceback (most recent call last):
  File "taskcoach.pyw", line 22, in <module>
  File "taskcoach.pyo", line 42, in start
  File "taskcoachlib\application\application.pyo", line 38, in __init__
  File "taskcoachlib\application\application.pyo", line 84, in init
  File "taskcoachlib\application\application.pyo", line 96, in
warnUserThatIniFileWasNotLoaded
  File "wx\_misc.pyo", line 493, in MessageBox
wx._core.PyAssertionError: C++ assertion "wxAssertFailure" failed at
..\..\src\msw\msgdlg.cpp(137) in wxMessageDialog::ShowModal():
unexpected ::MessageBox() return code

The call to wx.MessageBox looks like this:

wx.MessageBox(\
            _("Couldn't load settings from TaskCoach.ini:\n%s")%reason,
            _('%s file error')%meta.name, style=wx.ICON_ERROR)

First I thought that showing the MessageBox before showing the main
window could be the issue, but this little program works as expected:

import wx

class Frame(wx.Frame):
    def __init__(self):
        wx.MessageBox('test', 'test')
        super(Frame, self).__init__(None)

app = wx.App(0)
frame = Frame()
frame.Show()
app.MainLoop()

Any ideas?

There are some return values documented for the API that wx is not checking for, but I don't see how they could be generated from wx.MessageBox. For example, the MessageBox win32 API can return IDABORT which wx is not checking for, but that would only be returned if the flags were specified for an Abort button on the dialog and wx doesn't support or use that... Please create a ticket about this.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!

Since I've had another user report about this just now (two and a half
years later :slight_smile: I've finally opened a ticket:
trac.wxwidgets.org/ticket/13669

Cheers, Frank

···

2009/4/16 Robin Dunn <robin@alldunn.com>:

Frank Niessink wrote:

Hi,

A Task Coach user is reporting this traceback:

Traceback (most recent call last):
File "taskcoach.pyw", line 22, in <module>
File "taskcoach.pyo", line 42, in start
File "taskcoachlib\application\application.pyo", line 38, in __init__
File "taskcoachlib\application\application.pyo", line 84, in init
File "taskcoachlib\application\application.pyo", line 96, in
warnUserThatIniFileWasNotLoaded
File "wx\_misc.pyo", line 493, in MessageBox
wx._core.PyAssertionError: C++ assertion "wxAssertFailure" failed at
..\..\src\msw\msgdlg.cpp(137) in wxMessageDialog::ShowModal():
unexpected ::MessageBox() return code

The call to wx.MessageBox looks like this:

wx.MessageBox(\
_("Couldn't load settings from TaskCoach.ini:\n%s")%reason,
_('%s file error')%meta.name, style=wx.ICON_ERROR)

First I thought that showing the MessageBox before showing the main
window could be the issue, but this little program works as expected:

import wx

class Frame(wx.Frame):
def __init__(self):
wx.MessageBox('test', 'test')
super(Frame, self).__init__(None)

app = wx.App(0)
frame = Frame()
frame.Show()
app.MainLoop()

Any ideas?

There are some return values documented for the API that wx is not checking
for, but I don't see how they could be generated from wx.MessageBox. For
example, the MessageBox win32 API can return IDABORT which wx is not
checking for, but that would only be returned if the flags were specified
for an Abort button on the dialog and wx doesn't support or use that...
Please create a ticket about this.