win32com question using R com interface

Brian Kelley bkelley at wi.mit.edu
Thu Mar 7 13:52:34 EST 2002


I have been trying to translate some visual basic code to python and 
have been running into a slight problem

I am having some problems sending vectors or arrays across the interface.

here is the VB code

Dim x As StatConnector
Dim i3(5) As Integer
i3(1) = 5
i3(2) = 4
i3(3) = 3
i3(4) = 2
i3(5) = 1
Set x = New StatConnector
x.Init ("R")
x.SetSymbol "i3", i3

Here is the python code

from win32com.client import Dispatch
i3 = (5,4,3,2,1)
x=Dispatch("StatConnectorSrv.StatConnector")
x.Init("R")
x.SetSymbol("i3", i3)

This results in an error
File "<COMObject StatConnectorSrv.StatConnector>", line 2, in SetSymbol
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, 
None, None, 0, -2147024809), None)

Now x.SetSymbol("i3", "foo") or x.SetSymbol("i3", 3.0) works just fine. 
    So, the question is are the two codes equivalent or am I sending the 
wrong thing (the tuple) to the server?

Any help would be appreciated.

Brian Kelley
Whitehead Institute for Biomedical Research





More information about the Python-list mailing list