7

I am interested in getting some Python code talking to some Ruby code on Windows, Linux and possibly other platforms. Specificlly I would like to access classes in Ruby from Python and call their methods, access their data, create new instances and so on.

An obvious way to do this is via something like XML-RPC or maybe CORBA but I would be interested in any other approaches.

What have other people done to get code from Python and Ruby communicating with one another, either locally on the same system or remotely accross a network?

Thanks in advance.

1
  • 1
    I would like some motivation or explanation of why you need to do this. Commented Oct 16, 2008 at 20:25

5 Answers 5

4

Well, you could try named pipes or something similar but I really think that XML-RPC would be the most headache-free way.

Sign up to request clarification or add additional context in comments.

Comments

3

Please be advised that I don't speak from personal experience here, but I imagine JRuby and Jython (The ruby and python implementations in the JVM) would be able to to easily talk to each other, as well as Java code. You may want to look into that.

2 Comments

This sounds interesting, does anyone have experience with this?
Yes, i like the idea of everything opperating in the same jvm and as such a 'native' bridge between them. interesting suggestion nemo, thanks.
2

This isn't what your after, but worth a read: embed Python interpreter in Ruby: this code's pretty old

http://www.goto.info.waseda.ac.jp/~fukusima/ruby/python/doc/index.html

OR: why, rewriting bytecodes

http://github.com/why/unholy/tree/master

Comments

1

Using JRuby/Jython for Ruby/Python interoperability? has more information. Of note: JRuby and Jython don't have object compatibility, but IronPython and IronRuby do.

Comments

1

Expose your Ruby classes as web services using Sinatra, Rails, or, plain old Rack.

Expose your Python classes as web services using web.py, flask, Django, or App Engine.

Use HTTParty for Ruby to build an API into your Python classes.

Use a Python REST library to build an API into your Ruby classes.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.