I have a subprocess in Python, which runs a Ruby script.
import subprocess
cmd="ruby -v"
p=subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE, env={ 'PATH': '/sbin:/bin:/usr/bin' })
p.wait()
output, errors = p.communicate()
status = 'Estado de la app: ' + str(output) + 'Errores: ' + str(errors)
return status
The problem is that it gives a wrong Ruby version. This runs on a server so through SSH I installed Ruby 2.2.1 with rvm, and when I run ruby -v
it gives me the right information. But when I run the python from web2py it gives me an older version of Ruby, which is the one in /usr/bin/ruby.
It is like the subprocess runs in a whole different shell. What could it be?
Thanks