I'm trying to run external commands (note the plural) from a Python script. I've been reading about the subprocess
module and use it. It works for me when I have a single or independent commands to run, whether I'm interested in the stdout or not.
What I want to do is a bit different: I want something persistent. Basically the first command I run is to log in an application, then I can run some other commands which only work if I'm logged in. For some of these commands, I need the stdout.
So when I use subprocess
to login, it does it, but then the process is killed and next time I run a command with subprocess
, I'm not logged in anymore... I just need to run a series of commands, like I would do it in a terminal.
Any idea how to do that?