I read in books that you are capable of incorporating scripts of other languages into Python. Is it possible to take variables from a ruby script, pass them to a python function, and then return the output back to Ruby? If so, how? Every answer will be greatly appreciated!
Here are a few ways you could do it. Note that none of these has exceptionally high performance:
It might be overkill, but I have used socket programming before to set up a client-server relationship between Python and Ruby. At the very least this approach feels cool.
You could write and read from a common file. But then you have to worry about concurrency issues.
backticks can be used to send something to a Python module. In the Python module you wouold then use argv to process the sent data and then return back some result to the Ruby code.
For further information I would suggest looking at another similar StackOverflow question.
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