I am trying to use subprocesses with python. Here is my task:
- Run api through the command line (this is no different from running any argument on the command line)
- Confirm my API has appeared. The easiest way to do this is to poll the standard.
- Run the command against the API. A command line will appear when I can run a new command
- Verify that the command is completed by polling standard output (API does not support logging)
What I have tried so far:
1. I am stuck here using Popen. I understand that if I use
subprocess.call("put command here")it works. I wanted to try using something similar to:
import subprocess
def run_command(command):
p = subprocess.Popen(command, shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT)
where I use run_command("insert command here"), but it does nothing.
2. , :
Python ,
1. , .