RPyC 2.40

tomerfiliba at gmail.com tomerfiliba at gmail.com
Thu Mar 9 21:19:40 CET 2006


hello pythoneers,

last week i released RPyC 2.40 -- http://rpyc.sf.net -- but didnt have
time to announce it. also, i updated the site and added sections. i'm
not going to repeat the code snippet from the previous release (2.32),
you can see full demos on the site.

so, of course this release adds many internal changes and (a very few)
bugfixes, but the reason i announce it is the new feature added: direct
execution of code on the remote side. previously, you had to distribute
modules (files) over to the server's side, in order to have remote
code, but with the new `execute` method, you can do it with ease.

=====
from Rpyc import SocketConnection
c = SocketConnection("somehost")

c.execute("something = 9")
c.execute("print something")
c.execute("""
def f(name):
    print "hello %s, something is %r" % (name, something)
""")
=====

and of course you can use the objects you named, via the `namespace`:

=====
c.namespace.something = 28
c.namespace.f("lucy")
=====

that's just a code snippet. see the site and demos (demo-6.py) for much
more info.
note: this mechanism allows you to "embed" remote code into your local
code, so you dont have to maintain two different files. it should be
used when you write ONE module that has two aspects to it (remote code
and local code).
but dont go and embed different modules into each other -- use it
properly. if your scenario calls for two modules, use two modules.
don't use shortcuts.

and as always, enjoy.
-tomer



More information about the Python-announce-list mailing list