I'm trying to run a php script with python's subprocess module.
proc = subprocess.Popen(['php', '-f', test.php], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
retCode = proc.wait
print retCode
val = float(kprocess.stdout.read())
return val
I've also tried:
proc = subprocess.Popen(['php', '-f', test.php], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
val = float(kprocess.communicate()[0])
return val
Both ways work locally when I just run it in a python interpreter, however when I try to run it on the actual server, I always get "ValueError at / empty string for float()". This leads me to believe that the process is somehow not being waited for. What am I missing?
EDIT: I'm using Django, so it only seems to break when I run with Django.