COM "out" Variant Array params and such
MarkH at ActiveState.com
Mon Dec 3 01:30:03 CET 2001
Michael Kelly wrote:
> strange errors and also a quandry. The
> quandry is I can't figure how to make a
> call that has an "out" parameter that
> is not a retval and is a Variant Array.
> When I make the call in Python as in
> MyIniFile.ReadSections("Section name", VariantArrayofStrings)
> whatever I put for VariantArrayofStrings never get assigned anything.
VariantArrayofStrings is an "out" param - it should not be assigned
The correct way to call this should be:
VariantArrayOfStrings = MyIniFile.ReadSections("Section name")
You probably need to generate "makepy" support for this to work - but it
seems you have already done that.
> I read some stuff in the docs about coercing PyObject and Variants
> but with no real pointers where to see how this is done.
Some pretty deep magic. The type libraries are processed, and code that
calls PyIDispatch::InvokeTypes() is called. The "type tuple" passed to
InvokeTypes directs InvokeTypes on how to transform the Python args.
> The weird behavior is if I use the method WriteDate to write
> a date and then ReadDate to read it back I get an exception:
> type: exceptions.SystemError
> value: error return without exception set
This is a bug. Something like that has been fixed recently, but without
more details I can not be sure if it is exactly the same thing.
More information about the Python-list