Mark Hammond wrote:
["Invalid number of parameters"]
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?

Assuming the exception is a COMException, then yeah, it is the COM object itself which is throwing the error - ie, it isn't Python complaining about the missing param.

It's a pywintypes.com_error.. I'm assuming that's equivalente to a COMException then.


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"?

Exactly - when 'Missing' is used, the win32com bridge doesn't pass anything for the arg (ie, the "number of params" Python indicates it has passed doesn't include that param). When it is called as generated by makepy though, the parameter is always passed, but using the default value supplied by the type-library if one isn't specified by the Python code.

This just sounds like a bug in the COM object.

I see.. Many thanks for your assistance :)

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to