COM "out" Variant Array params and such
mkelly2002NOSPAM at earthlink.net
Sun Dec 2 21:34:41 CET 2001
I like to roll my own COM and ActiveX components
and I've been experimenting with using them(they
are mostly written with Delphi 5 as "automation
server" or ActiveX inprocess dlls or ocxs) with
ActivePython version of Python 2.1.
I have an Ini File component that wraps the
Delphi TIniFile class that works fine for
D5, VB6 and VC++6 but in Python I get some
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.
I read some stuff in the docs about coercing PyObject and Variants
but with no real pointers where to see how this is done.
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:
value: error return without exception set
I have no idea what this means except maybe
the exception mechanism has a problem. I
used makepy.py to make a coclass that I
import to use the Ini File COM object.
At any rate neither of these seem to be an
issue in Delphi 5, VB 6 or VC++6. I even
tried the underlying TIniFile type is a Delphi
test program to make sure it reads correctly
dates written with WriteDate method.
I seem to be able to Write dates and times
to the ini file ok. Reading them back
causes this exception, but I can read
them in as strings I suppose and then
convert the string by some means back
to a Date or Time but that kind of kills
off the convenience of using this nifty
component(TIniFile that I wrapped up
Any ideas appreciated. :)
"I don't want to belong to any club that would have me as a member."
-- Groucho Marx
More information about the Python-list