我使用pyrserve从Python调用R脚本文件。我有奔跑。在R脚本的任意点,Pyrserve给出了错误并退出:
Traceback (most recent call last):
File "scriptV2.py", line 272, in <module>
rConn.eval("source(file.PropensityFlow)")
File "/Users/dipayanmaiti/Py3.3venv/lib/python3.3/site-packages/pyRserve/rconn.py", line 47, in decoCheckIfClosed
return func(self, *args, **kw)
File "/Users/dipayanmaiti/Py3.3venv/lib/python3.3/site-packages/pyRserve/rconn.py", line 119, in eval
return rparse(src, atomicArray=atomicArray)
File "/Users/dipayanmaiti/Py3.3venv/lib/python3.3/site-packages/pyRserve/rparser.py", line 539, in rparse
return rparser.parse()
File "/Users/dipayanmaiti/Py3.3venv/lib/python3.3/site-packages/pyRserve/rparser.py", line 349, in parse
self.lexer.readHeader()
File "/Users/dipayanmaiti/Py3.3venv/lib/python3.3/site-packages/pyRserve/rparser.py", line 94, in readHeader
self.responseCode = struct.unpack(b'<i', self.read(3) + b'x00')[0]
File "/Users/dipayanmaiti/Py3.3venv/lib/python3.3/site-packages/pyRserve/rparser.py", line 149, in read
raise EndOfDataError()
pyRserve.rparser.EndOfDataError
我已将rserv.conf
设置为以下内容:
maxinbuf 20000000
maxsendbuf 0
有人知道为什么会发生这种情况吗?这看起来像一些缓冲问题,因为R脚本本身运行。
这是一个较晚的答案,但是在这种情况下,在调试模式下运行rserve是有用的,因此可以在单独的外壳中监视其输出。
R CMD Rserve.dbg
在某些极少数情况下,我见过Rserve打印警告,当发生这种情况时,命令通过pyrserve发送的命令并没有从rserve返回任何值,这导致了上面的" EndofDataError"。
<</p>