Skip to content

Instantly share code, notes, and snippets.

@shapiromatron
Last active February 5, 2018 17:45
Show Gist options
  • Select an option

  • Save shapiromatron/80a2547a599441332c736ff5d836097b to your computer and use it in GitHub Desktop.

Select an option

Save shapiromatron/80a2547a599441332c736ff5d836097b to your computer and use it in GitHub Desktop.
pyRserve

Testing that state isn't shared between two Rserve connections using pyRserve:

>>> import pyRserve
>>> conn1 = pyRserve.connect(host='localhost', port=6311)
>>> conn2 = pyRserve.connect(host='localhost', port=6311)
>>> conn1.eval('x<-function(n){n**2}')
>>> conn1.r.x(2)
4.0
>>> conn2.r.x(2)
Traceback (most recent call last):
  File "<input>", line 1, in <module>
    conn2.r.value
  File "/python3.6/site-packages/pyRserve/rconn.py", line 308, in __getattr__
    'defined in Rserve' % realname)
NameError: no such variable or function "x" defined in Rserve

Related: https://stackoverflow.com/questions/34349014/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment