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 = urllib.unquote(p.stdout.read())
return output
newpath='/path/to/program/directory'
os.chdir(newpath)
cmd=os.path.join(newpath,'a.out')
output=run_cmd(cmd);
--
View this message in context:
http://www.nabble.com/permissions-problem-using-subprocess-tp15402550p15402849.html
Sent from the Python - tutor mailing list archive at Nabble.com.
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor