Hi All, I'm trying to call LabVIEW VI's from python. I'm using comtypes to invoke the LabVIEW ActiveX. While using this I'm trying to pass data to a 'Call' method in 'VirtualInstrument' class of this ActiveX. I'm able to pass all types of data. Except a 2D array. I get the following error when I try to pass a 2D array.
VirtualInstrument.Call(ParameterNames,Parameters) File "C:\Python27\lib\site-packages\comtypes\__init__.py", line 517, in func return self.Invoke(obj, memid, _invkind=1, *args, **kw) # DISPATCH_METHOD File "C:\Python27\lib\site-packages\comtypes\automation.py", line 717, in Invoke raise COMError(hresult, text, details) COMError: (-2147352567, 'Exception occurred.', (None, None, None, 0L, -2147352571)) This COM error means Type Mismatch. When I tried using Pywin I faced the same issue with a cluster(structure) of clusters(structures) having same number of elements. As in the attachment cluster.jpg Like [[1,2,3],[4,5,6]] where [1,2,3] is one cluster and [4,5,6] is another cluster But I was able to pass the data to 2D array in Pywin. Using comtypes I'm able to pass data to the custer of cluster data type but I'm facing issues with 2D array. Here is my code: *from ctypes import ** *import comtypes.client* *omtypes.CoInitialize()* *TypeLibPath = "C:\\LabVIEW Run Time Engine ActiveX Server\ActiveX Server\LVRTS.tlb"* *comtypes.client.GetModule(TypeLibPath)* * * *try:* * Application = comtypes.client.CreateObject("LabVIEWRTS.Application", None, None, comtypes.gen.LabVIEWRTS._Application)* * #VI Path* * VIPath="C:\Passing Array Data.vi"* * * * #Parameters* * Input_1=[[1,2,3],[4,5,6]]* * Input_2=[[1,2,3],[4,5,6]]* * ParameterNames=("Input 1","Input 2")* * Parameters=[Input_1, Input_2,]* * * * #Get VI Reference* * VirtualInstrument = Application.GetVIReference(VIPath)* * * * #Call VI* * VirtualInstrument.Call(ParameterNames,Parameters)* * ....* * ....* * ....* Thanks, Sathish
------------------------------------------------------------------------------ This SF.net email is sponsored by Make an app they can't live without Enter the BlackBerry Developer Challenge http://p.sf.net/sfu/RIM-dev2dev
_______________________________________________ comtypes-users mailing list comtypes-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/comtypes-users