Problem with using PythonWin and ActiveX COM Object

William Wicker remove.me.wwicker at spectratechnologies.com
Wed Oct 4 13:39:36 EDT 2000


On Wed, 4 Oct 2000 16:02:27 +0200, "Alex Martelli" <aleaxit at yahoo.com>
wrote:

>"Jeremy Howard" <jeremyh at flashcom.com> wrote in message
>news:stkikpeusp7057 at corp.supernews.com...
>> I've asked this before but never really got an answer. I'm working for a
>> company that is using Siebel CRM software.  This software comes with COM
>> objects for accessing their system from external applications.  Below is
>the
>
>I don't know the details of their interfaces, but I'll give it a
>try based on what you post...
>

<snip>

>
>It looks, specifically, as if iErr is passed by-reference; i.e., a
>_reference_ to iErr is given to the LoadObjects method, which places
>an error-code there (a strange thing to do in COM, although allowed;
>normally, COM returns errors quite differently -- this looks like a
>partial translation of some older C API...?).
>
I am working with a different package, but just enough of the COM
interface includes functions with an interface like this (return
values stuck in parameters passed by reference) to be really (REALLY)
frustrating.

<snip>

>
>Python's COM interface is no doubt passing iError by value (it always
>does: no pass-by-reference in Python!) and I think this is what the
>Siebel object is diagnosing as a type-error.
>

I though *everything* in Python was by-reference?


>Try calling LoadObjects with just one argument, the path to the file;
>it should then *RETURN* the iError value as its *RESULT*.  I.e.,
>change the offending line to
>
>    iError = objSiebel.LoadObject(r'c:\siebel\bin\psblprd.cfg')
>

I've tried this in my application, and get complaints about missing
arguments.

>(I'm using the r'' syntax to avoid having to double up the backslashes,
>but that's another, purely-syntactic-sugar issue!).
>
>This is how Python's COM support handles by-reference, output values: it
>transforms them into results.  You may have to run makepy on the type
>library of interest, and maybe use EnsureDispatch or equivalent to make
>sure the genpy-supplied wrappers are used rather than purely dynamic
>dispatching (it's a rather advisable thing anyway, in general), but I
>think you might be able to get away without that.
>

I haven't tried then genpy interface. That might work.

	William.



More information about the Python-list mailing list