[python-win32] Wrong default value for optional argument in makepy signature.
Tim Roberts
timr at probo.com
Tue Nov 9 18:26:03 CET 2010
Åsmund Hjulstad wrote:
> I keep getting the following exception when making some calls on a
> ActiveX DLL library (PISDK). Problem partially solved, posting in case
> others may find it usefull.
>
> TypeError: The Python instance can not be converted to a COM object
>
> I have traced it down to an optional parameter, that is set to 0, but
> should (probably) be set to None.
>
> the makepy signature is:
>
> GetPoints(self, WhereClause=<PyOleEmpty object>, pAsynchStatus=0)
>
> Doing the call using
>
> server.GetPoints(" tag = 'FT12345/*' ", None)
>
> works fine. ...
>
> As the optional parameter is easy to forget, especially when querying
> interactively in ipython, is it possible to make makepy understand
> that the optional parameter should be None, instead of 0?
Makepy makes an educated guess, based on the data type of the
parameter. However, some people lie about their data types when they
make an interface like this. Instead of declaring it a pointer, they'll
declare it as an integer. Makepy isn't omniscient.
Do you have the IDL that describes the function, or a web page
reference? Can you show us the script that makepy generated?
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
More information about the python-win32
mailing list