tagged [subprocess]

How to terminate a python subprocess launched with shell=True

How to terminate a python subprocess launched with shell=True I'm launching a subprocess with the following command: However, when I try to kill using: or The command keeps running in the background, ...

21 Oct at 12:48

Launch a shell command with in a python script, wait for the termination and return to the script

Launch a shell command with in a python script, wait for the termination and return to the script I've a python script that has to launch a shell command for every file in a dir: This works fine for t...

28 Nov at 11:35

running multiple bash commands with subprocess

running multiple bash commands with subprocess If I run `echo a; echo b` in bash the result will be that both commands are run. However if I use subprocess then the first command is run, printing out ...

19 Jul at 09:36

What's the difference between subprocess Popen and call (how can I use them)?

What's the difference between subprocess Popen and call (how can I use them)? I want to call an external program from Python. I have used both `Popen()` and `call()` to do that. What's the difference ...

24 May at 00:16

Passing variables to a subprocess call

Passing variables to a subprocess call I am trying to pass my variables from `raw_input` to my subprocess command. I am new to Python. Any help would he appreciated. ``` #!/usr/bin/python import subpr...

16 Nov at 16:31

Actual meaning of 'shell=True' in subprocess

Actual meaning of 'shell=True' in subprocess I am calling different processes with the `subprocess` module. However, I have a question. In the following code: and Both work. After reading the docs, I ...

27 Dec at 01:6

check output from CalledProcessError

check output from CalledProcessError I am using subprocess.check_output from pythons subprocess module to execute a ping command. Here is how I am doing it: It is raising a CalledProcessError and says...

27 Sep at 20:32

How to hide output of subprocess

How to hide output of subprocess I'm using eSpeak on Ubuntu and have a Python 2.7 script that prints and speaks a message: eSpeak produces the desired sounds, but clutters the shell with some errors (...

25 Sep at 18:20

Using module 'subprocess' with timeout

Using module 'subprocess' with timeout Here's the Python code to run an arbitrary command returning its `stdout` data, or raise an exception on non-zero exit codes: `communicate` is used to wait for t...

Understanding Popen.communicate

Understanding Popen.communicate I have a script named `1st.py` which creates a REPL (read-eval-print-loop): I then launched `1st.py` with the following code:

14 May at 13:24