COM "out" Variant Array params and such

Michael Kelly mkelly2002NOSPAM at
Mon Dec 3 13:18:19 EST 2001

On Mon, 03 Dec 2001 00:30:03 GMT, Mark Hammond <MarkH at>

>Michael Kelly wrote:

>VariantArrayofStrings is an "out" param - it should not be assigned 
I changed to non-retval out param to solve problems with
other COM client environments as noted below.

>The correct way to call this should be:
>VariantArrayOfStrings = MyIniFile.ReadSections("Section name")

I implemented it that way initially but had all kinds of problems with
clients in other languages, so I changed it to an out param that was
not a retval and that cleared things up for at least VB6, D5 and
Vc++6.  My initial version was a Custom Interface but when I started
experimenting with Python I redid it as a dual-interface IDispatch.
I tried the IDispatch version again in VB and D5 with no problems
at all.

>You probably need to generate "makepy" support for this to work - but it 
>seems you have already done that.

Yeah, that's really neat.  It's nice to be able to just use the
CoClass.  I tried little test driver apps importing the created
module using both the ...IDispatch() to create the instance and just
assigning to a variable as in MyIniFile = DIniFile()
and both seem to work indentically.

I was just hoping this would work smoothly as it would be a nice
convenience component for win32 and I'd be glad to post the
.dll on a board for download at some point when I've got the
hinks out. :)

>> 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.

I noticed something that sounded similar on the bug list.  Is
ActivePython using an older build of win32-all??  There seems
to be a download for a newer build on the ActivePython site
but it stipulates it's for use with the other dist.  I downloaded
it but I'm wondering if unpacking on top of ActivePython will
hose my installation?

Thanks for your replies Mark.  I'm having a lot of fun with COM
and Python.



"I don't want to belong to any club that would have me as a member."
    -- Groucho Marx

More information about the Python-list mailing list