Optional Parameters in python COM

R

Rane Bowen

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
 
M

Mark Hammond

Rane said:
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.

Can you reproduce this problem with a "common" object, such as IE,
MSOffice, or a trivial VB object with sourcecode? The problem is that
it is up to each object to implement optional params, so it is very hard
to pinpoint bugs in win32com here.

Mark.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top