Passing a tuple of lists to ActiveX

Anand anand at calbay.com
Tue Mar 4 11:33:30 EST 2003


Mark,
           I get the following error when in tried
win32com.client.gencache.EnsureDispatch("Labview.application")
Traceback (most recent call last):
  File "<interactive input>", line 1, in ?
  File "C:\PROGRA~1\Python22\lib\site-packages\win32com\client\gencache.py",
line 434, in EnsureDispatch
    disp_class = CLSIDToClass.GetClass(str(disp_clsid))
  File "C:\PROGRA~1\Python22\lib\site-packages\win32com\client\CLSIDToClass.py",
line 50, in GetClass
    return mapCLSIDToClass[clsid]
KeyError: {9A872071-0A06-11D1-90B7-00A024CE2744}


> Did you try passing back in exactly what you got out?  Maybe labview is 
> not smart enough to deal with an array of ints and convert them to doubles.
    I tried all different combinations. Nothing worked. But None
works. it clears the graph.


Mark Hammond <mhammond at skippinet.com.au> wrote in message news:<IwS7a.651$Xh1.1905 at news-server.bigpond.net.au>...
> Anand wrote:
> > Hi,
> >        I am trying to talk to labview XY graph using ActiveX. Here is
> > a small piece of code that i used.
> > 
> > 
> >>>>LV = win32com.client.Dispatch("Labview.application") #get an
> 
> Try replacing this with:
> 
> LV = win32com.client.gencahce.EnsureDispatch("Labview.application")
> 
> This will create any type info available for the object.  This may 
> infact be all you need to do.
> 
> Currently, without type info, Python may be making its best guess for 
> the type you want to send (it will guess a safe-array of integers in 
> your example.)  With type info, Python may be told the specific type 
> (which may be a safearray of doubles)
> 
> > 
> > handle to labview activex server
> > 
> > 
> >>>>vi = lv.getvireference(r'c:\test.vi') # open the vi containing the
> > 
> > graph
> > 
> > 
> >>>>vi.setcontrolvalue("Graph1",[(1,2,3),(1,2,3)])
> > 
> > Traceback (most recent call last):
> >   File "<interactive input>", line 1, in ?
> >   File "<COMObject <unknown>>", line 2, in setcontrolvalue
> > com_error: (-2147352567, 'Exception occurred.', (0, None, None, None,
> > 0, -2147352571), 2)
> > 
> >>>>vi.getcontrolvalue("Graph1")
> > 
> > ((10.0, 11.0), (10.0, 11.0))
> > 
> > I am able to read from the graph object but i am not able to write to
> > it!. 
> 
> Did you try passing back in exactly what you got out?  Maybe labview is 
> not smart enough to deal with an array of ints and convert them to doubles.
> 
> Mark.




More information about the Python-list mailing list