R和Python之间的连接

时间:2014-08-27 09:18:47

标签: python windows r

我只是想通过Python连接到R,使用以下代码。但是,在初始化R

时会抛出错误
> from win32com.client import Dispatch
> sc=Dispatch("StatConnectorSrv.StatConnector")
> sc.Init("R")

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<COMObject StatConnectorSrv.StatConnector>", line 2, in Init
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None,
 0, -2147221485), None)

> print(sc.Evaluate("2+2"))

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<COMObject StatConnectorSrv.StatConnector>", line 2, in Evaluate
  File "E:\Anaconda\lib\site-packages\win32com\client\dynamic.py", line 282, in
_ApplyTypes_
    result = self._oleobj_.InvokeTypes(*(dispid, LCID, wFlags, retType, argTypes
) + args)
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, None, None, None,
 0, -2147221500), None)

0 个答案:

没有答案