[python-win32] Calling a method with SAFEARRAY parameter

Alessandro Fiorino alessandro.fiorino at digitaldomus.it
Wed Sep 25 07:41:43 EDT 2024


I have to call a method of a COM Object which is defined as
GetTableInfo ([in] BSTR bstrTableName,[in, out]
SAFEARRAY(BSTR)*bstrColumnTitles,[in, out] SAFEARRAY(long)*lColumnPos)

I tried with
            columnTitles = VARIANT(pythoncom.VT_ARRAY | pythoncom.VT_BSTR,
[None])
            columnPos = VARIANT(pythoncom.VT_ARRAY | pythoncom.VT_I4,
[None])
            object.GetTableInfo("TABLENAME", columnTitles, columnPos)
and with
            columnTitles = VARIANT(pythoncom.VT_ARRAY | pythoncom.VT_BSTR,
[""])
            columnPos = VARIANT(pythoncom.VT_ARRAY | pythoncom.VT_I4, [0])
            object.GetTableInfo("TABLENAME", columnTitles, columnPos)

but I get an error:
Object ot type VARIANT has no len()

What I am doing wrong ?

Thanks in advance.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/python-win32/attachments/20240925/cf5873c4/attachment.html>


More information about the python-win32 mailing list