I’m not sure about the context on this one, but shouldn’t you be calling the 
COM object with data like:

            columnTitles = VARIANT(pythoncom.VT_ARRAY | pythoncom.VT_BSTR, 
[“something”])

Versus:

            columnTitles = VARIANT(pythoncom.VT_ARRAY | pythoncom.VT_BSTR, 
[None])

Without context, I can’t actually do much other than this suggestion.

HTH

Steven
From: python-win32 <python-win32-bounces+steven=manross....@python.org> On 
Behalf Of Alessandro Fiorino
Sent: Wednesday, September 25, 2024 4:42 AM
To: python-win32@python.org
Subject: [python-win32] Calling a method with SAFEARRAY parameter

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.

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

Reply via email to