[python-win32] Invalid number of parameters on makepy-generated method

Federico Fanton federico at panizzolo.it
Mon Oct 4 09:29:43 CEST 2010


Tim Roberts wrote:

>> It is mostly working, except for a call to a method that accepts a
>> single optional boolean parameter. When I try to call this method, I get
>> an "Invalid number of parameters" exception.
> 
> Is the exception coming from the InvokeTypes call?

Exactly..
I have a new bit of information though: I noticed that the problem 
arises ONLY when the controlled application (Alibre) is already running, 
while if it's not, there's no exception... Could it be that the "Invalid 
number of parameters" is thrown by something *after* the InvokeTypes?
That is, could it be an error of the API itself? Or would I get the 
exception elsewhere?


 >def Close(self, saveSession=False):
 >     """Closes the session and saves the modified session and
 > sub-sessions, if any, to their original folder locations, if the
 > saveSession flag is set to true. Use SaveNew or SaveAs if this session
 > is being saved for the first time"""
 >     return self._oleobj_.InvokeTypes(7, LCID, 1, (24, 0), ((11,
 > 49),),saveSession )

If I call the Close() method passing pythoncom.Missing, there's no error 
even when Alibre is already open... Is Missing a way to explicitly tell 
"I'm not passing you this parameter, use the default value"?

Many thanks for your attention!


More information about the python-win32 mailing list