mccredie at gmail.com
Fri Jun 20 01:00:13 CEST 2008
On Jun 18, 8:33 pm, "bruce" <bedoug... at earthlink.net> wrote:
> can someone point me to where/how i would go about calling a ruby app from a
> python app, and having the python app being able to get a returned value
> from the ruby script.
> something like
> a = os.exec(testruby.rb)
> foo = 9
> return foo
> i know this doesn't work... but i've been searching for hours on this with
> no luck.... (and yeah, i'm relatively new to both ruby/python!!)
Both Ruby and Python appear to support XMLRPC. I haven't used XMLRPC
in Ruby, but in general you create a server and expose some functions.
On the client end (Python) you would do something like this (assuming
you are serving on port 8050):
rubyserver = xmlrpclib.Server("http://localhost:8050")
x = rubyserver.foo(1,2,3)
where 'foo' is a function served by the ruby server and x is its
Good python server and client examples on this page:
I can't be of much help for ruby, and that link doesn't seem to help
much other than to say 1. it exists and 2. its easy.
More information about the Python-list