0

what is the mod_python equivalent to the php exec command?

$cmd = '/var/www/scripts/test.py' + $parameter
$return = exec($cmd)

I've tried this but it doesn't return anything

varReturn= subprocess.check_output(['/var/www/scripts/resolveID.py ', varParameters)

1 Answer 1

1

Capture the stdout and stderr of the subprocess:

from subprocess import Popen, PIPE

proc = Popen(['/var/www/scripts/resolveId.py', 'arg1', 'arg2'], stdout=PIPE, stderr=PIPE)
stdout, stderr = proc.communicate()
Sign up to request clarification or add additional context in comments.

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.