[python-win32] win32com problem with LabVIEW

Mark Hammond mhammond at skippinet.com.au
Fri Jun 24 16:11:52 CEST 2005


> I try to talk with Python to a LabVIEW-Application called 
> "cbt" via ActiveX.
> 
> Now I´m running into problem calling the "Call" method.
> 
> Here´s the code:
> ------------
> import win32com.client
> oLv = win32com.client.Dispatch("cbt.Application")

Try either

oLv = win32com.client.gencache.EnsureDispatch("cbt.Application")

or:

> strVi = oLv.ApplicationDirectory + "\\cbt.exe\\" + "cdcAxLogPrint.vi"
> 
> # retrieving the reference to the VI to be called via "Call"
> oViLogPrint = oLv.GetVIReference(strVi,"",True)   
> 
> arIn  = ["strEntry","Error"]
> arOut = ["Hello World",True]
> 

obViLogPrint._FlagAsMethod("Call")

> oViLogPrint.Call(arIn,arOut)

> ------------
> The resulting error message:
>     oViLogPrint.Call(arIn,arOut)
> TypeError: 'NoneType' object is not callable

The problem is that .Call is being interpreted as a property reference
rather than a method call.  The former should trigger early-binding, which
should  avoid the problem.  If that doesn't work, the latter is still using
late-binding, but offering a hint to win32com that Call is a method rather
than a property.

Mark
-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 2152 bytes
Desc: not available
Url : http://mail.python.org/pipermail/python-win32/attachments/20050625/4856572f/winmail.bin


More information about the Python-win32 mailing list