out parameters in Python and COM

Steve Holden sholden at holdenweb.com
Thu Oct 24 09:54:02 EDT 2002


[posted & mailed]
> Hi,
>
> Code snippet at the end of the post. I have an exe which exposes an
> IDispatch interface. The GetCodeTable method has 4 parameters, the
> first 3 of them are of the type [out] BSTR*, the 4th parameters is an
> [out,retval] long *. When debugging my exe using Python I always get
> empty values for a,b and c allthough they are filled in with the
> correct values inside the exe (I checked this with the visual studio
> debugger).
>
> Any idea what is wrong with my script below?
>
> import win32com.client
>
> atm = win32com.client.Dispatch("ATM.Shell")
> b4 = atm.LogOn("Administrator", "EHSW", "Python")
>
> a=""
> b=""
> c=""
> HEMgr = atm.ATMHeadEndManager
> HEMgr.SetCodeTable("BS","ES","EE")
> HEMgr.GetCodeTable(a,b,c)
> print a
> print b
> print c

Henk:

I've seen a couple of answers to your original question posted on c.l.py,
and was therefore somewhat surprised to see you ask it again three days
later - are you not checking that group, or is your news server responding
slowly?

Generally, if you don't ask for replies by email you should expect them to
appear in the newsgroup/mailing list. For the record, the most useful answer
was probably Mark Hammond's:

> > Any idea what could be wrong?
>
> In Python, these values are still *returned*.
[...]
> Your code should say:
>
> a,b,c,d = HEMgr.GetCodeTable()

regards
-----------------------------------------------------------------------
Steve Holden                                  http://www.holdenweb.com/
Python Web Programming                 http://pydish.holdenweb.com/pwp/
Previous .sig file retired to                    www.homeforoldsigs.com
-----------------------------------------------------------------------






More information about the Python-list mailing list