[python-win32] Re: 'NoneType' object is not callable

Mark Hammond mhammond at skippinet.com.au
Tue Sep 7 08:53:36 CEST 2004


> This is very puzzling... I've been through the VC++
> automation wizard at
> least 3 times, each time I am sure it is executing as a method (for
> example, I put in an AfxMessageBox() that executes in the body of the
> method).  A VB client likewise has no problem with it.  Can
> you give me
> some clue as to what might be happening?

The problem will most likely be in the MFC "Invoke" implementation.  You
should be able to set a breakpoint in Invoke, and see that Python is calling
it with just INVOKE_PROPERTYGET - not INVOKE_FUNC.  I suspect the MFC code
is not differentiating between being called with PROPERTYGET or FUNC -
Python needs it to fail.

> >>I always get this error when calling a function on the automation
> >>server: 'NoneType' object is not callable
> >>Then the python program stops executing.  In the code below,
> >>mfcserver.SendMessage1() gives the error, and the print
> >>"Finished" line
> >>never executes.
> >
> >
> > Your COM server is reponding to a request for a *property* named
> > "SendMessage1", and returning None.  Python it then
> attempting to call it.
> > You should raise DIS_E_MEMBERNOTFOUND when it is requested
> as a property.

Mark



More information about the Python-win32 mailing list