Instead of

ret = adm.GetDataSet("172.16.145.16",dataset)
print dataset

do this:

ret, dataset = adm.GetDataSet("172.16.145.16")
print dataset


It's equivalent to passing a reference in other languages.

-Ryan





                                                                                       
             
                    "Carl Petersen"                                                    
             
                    <petersen@optic        To:     "Ryan Sackenheim" <[EMAIL PROTECTED]> 
             
                    ominc.com>             cc:     
<[EMAIL PROTECTED]>          
                                           Subject:     RE: Scope question when using 
WHYS and COM  
                    03/22/01 01:34                                                     
             
                    PM                                                                 
             
                                                                                       
             
                                                                                       
             





 # Use these commands in Python code to auto generate .py support
from win32com.client import gencache
gencache.EnsureModule('{095A053B-44E6-11CE-A609-00001D0898C6}', 0, 3, 0)

from win32com.client import Dispatch
sim = Dispatch("simmgr.Application")
sim.ShowWindow(0)
doc = sim.GetDocument
adm = doc.Admin

dataset = 0

# The following will fail with a type mismatch on the dataset variable.
# The GetDataSet method in the adm instance expects the dataset as a
# reference so it can modify the contents.
# Python does a pass by value passing 0 which will fail.

ret = adm.GetDataSet("172.16.145.16",dataset)
print dataset

Is there anyway to convince python to pass by ref?

--Carl Petersen





_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activepython

Reply via email to