Using Python to run executable and fill in user input
问题 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 questions and trying different things, but haven't had any luck. Here is a minimal example to show what I tried last #!/usr/bin/python import subprocess # Calling executable ps = subprocess.Popen('fortranExecutable',shell=True,stdin=subprocess.PIPE) ps.communicate('argument 1') ps.communicate('argument 2') However, when I try