Problems on callAfter

Hi list,
my customer report me this very strange error. The problem is that I
don't know exactly when happen, so this is the only thing that I can
wrote :frowning:

Exception in thread Thread-1:
Traceback (most recent call last):
   File "threading.pyo", line 442, in __bootstrap
   File "threading.pyo", line 422, in run
   File "twisted\internet\threadedselectreactor.pyo", line 154, in
_workerInThread
   File "twisted\internet\threadedselectreactor.pyo", line 123, in
_sendToMain
   File "twisted\internet\threadedselectreactor.pyo", line 266, in mainWaker
   File "wx\_core.pyo", line 13537, in CallAfter
AttributeError: 'NoneType' object has no attribute '_CallAfterId'

What can I do for debug it?

wx version 2.6.3.2 on python 2.4.3 + py2exe

Thanks,
Michele

Michele Petrazzo wrote:

Hi list,
my customer report me this very strange error. The problem is that I
don't know exactly when happen, so this is the only thing that I can
wrote :frowning:

Exception in thread Thread-1:
Traceback (most recent call last):
  File "threading.pyo", line 442, in __bootstrap
  File "threading.pyo", line 422, in run
  File "twisted\internet\threadedselectreactor.pyo", line 154, in
_workerInThread
  File "twisted\internet\threadedselectreactor.pyo", line 123, in
_sendToMain
  File "twisted\internet\threadedselectreactor.pyo", line 266, in mainWaker
  File "wx\_core.pyo", line 13537, in CallAfter
AttributeError: 'NoneType' object has no attribute '_CallAfterId'

What can I do for debug it?

I don't know, there is an assert in the code that ensures that the app is not None, but that is apparently what the cause of the error is.

def CallAfter(callable, *args, **kw):
     """
     Call the specified function after the current and pending event
     handlers have been completed. This is also good for making GUI
     method calls from non-GUI threads. Any extra positional or
     keyword args are passed on to the callable when it is called.

     :see: `wx.FutureCall`
     """
     app = wx.GetApp()
     assert app is not None, 'No wx.App created yet'

     if not hasattr(app, "_CallAfterId"):
         app._CallAfterId = wx.NewEventType()
         app.Connect(-1, -1, app._CallAfterId,
                     lambda event: event.callable(*event.args, **event.kw) )
     evt = wx.PyEvent()
     evt.SetEventType(app._CallAfterId)
     evt.callable = callable
     evt.args = args
     evt.kw = kw
     wx.PostEvent(app, evt)

···

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