I\'m trying to use Python to automate a process that involves calling a Fortran executable and submitting some user inputs. I\'ve spent a few hours reading through similar
your arguments should not be passed to communicate. they should be given in the call to Popen, like: http://docs.python.org/2/library/subprocess.html#subprocess.Popen
>>> import shlex, subprocess
>>> command_line = raw_input()
/bin/vikings -input eggs.txt -output "spam spam.txt" -cmd "echo '$MONEY'"
>>> args = shlex.split(command_line)
>>> print args
['/bin/vikings', '-input', 'eggs.txt', '-output', 'spam spam.txt', '-cmd', "echo '$MONEY'"]
>>> p = subprocess.Popen(args) # Success!