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.
Ruby and Python are two highly sought-after programming languages. They share many similarities and both are powerful options that solve specific problems. But few people know that Ruby and Python can be brought together to create efficient apps with capabilities for heavy calculations and handling Big Data.
To do so, you would need to make your script into a proper Python module, start the bridge when the Rails app starts, then use RubyPython. import to get a reference to your module into your Ruby code. The examples on the gem's GitHub page are quite simple, and should be sufficient for your purpose.
Well, you could try named pipes or something similar but I really think that XML-RPC would be the most headache-free way.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With