For example, I can use Python scripts in PHP like there:
exec("python script.py params",$result);
where "script.py" - script name and variable $result save output data.
How I can make it with Ruby? I mean, call Python scripts from Ruby.
For example, I can use Python scripts in PHP like there:
exec("python script.py params",$result);
where "script.py" - script name and variable $result save output data.
How I can make it with Ruby? I mean, call Python scripts from Ruby.
One way would be exec.
result = exec("python script.py params")
exec function will replace the current running process with the command supplied. If, like me, you're looking for a way to invoke a helping shell command and capture the result, you should use another method (i.e. "maniacalrobot"'s answer below).Another way to do the same thing would be,
system 'python script.py', params1, params2
system 'python', *["script.py", params1, params2] is more accurate, I think.