Optional Parameters in python COM

Rane Bowen raneb at slingshot.co.nz
Mon Jan 26 02:44:53 CET 2004


Hi,

I am using python with a makepy generated wrapper on a COM application. One
of this object's methods has 3 parameters, two of which are optional.
If I call the method with just the non-optional parameter, or all three
parameters, it works.  If I call it with the first two parameters, I get the
following error:

(-2147352567, 'Exception occurred.', (0, 'Amphora.Session.1', 'A bad
parameter was passed to the method', None, 0, -1610547133), None)

I have tried calling the method by using the names of the optional
parameters, and I have also tried using pythoncom.Missing and
pythoncom.Empty for the non essential parameter.  I have also edited the
generated .py file so that it contains the following:

defaultNamedOptArg=pythoncom.Empty
defaultNamedNotOptArg=pythoncom.Empty
defaultUnnamedArg=pythoncom.Empty

But this has not made any difference!  Any help would be very much
appreciated.

Cheers,

Rane





More information about the Python-list mailing list