win32com: how to call func with optional params

Tom Hines tom_hines at
Thu Mar 30 18:37:42 CEST 2000

How do you call a function with optional parameters in win32com?  In
Visual Basic you can write:

    obj.MyFunc(parm1, , , parm4)

but this is invalid syntax in Python.

In C++, you need to construct a special Variant argument like so:

    _variant_t vopt;
    vopt.vt = VT_ERROR;
    vopt.scode = DISP_E_PARAMNOTFOUND;
    obj.MyFunc(parm1, vopt, vopt, parm4);

How do you do it in Python?

Thanks for your help.

Tom Hines
Rockville, MD

Sent via
Before you buy.

More information about the Python-list mailing list