Answering my own question here, but for the sake of it... adding:
os.chdir(newpath)
makes it all work... so we have:
def run_cmd(cmd):
"""RUN A BASH CMD"""
import subprocess as sub
p = sub.Popen(['/bin/bash', '-c', cmd],
stdout=sub.PIPE, stderr=sub.STDOUT)
output =
Hello,
I'm converting a perl script which calls shell scripts which call fortran
routines into a python cgi that calls fortran directly (well, not yet using
f2py), but using subprocess.popen. Here's my code:
def run_cmd(cmd):
"""RUN A BASH CMD"""
import subprocess as sub
p = sub.Popen(