I am trying to run the following code in Python which calls a Bash script file and saves its output to a variable. I am trying to use subprocess.check_output
but it raises an error to the effect of "No such file or directory". subprocess.call
does not work either. Here is a bit of my code.
answer = subprocess.check_output(['/directory/bashfile.bash -c /directory/file -i input -o output'])
print answer
-c
-i
and -o
are just arguments to the script bashfile
.