tagged [subprocess]

What can lead to "IOError: [Errno 9] Bad file descriptor" during os.system()?

What can lead to "IOError: [Errno 9] Bad file descriptor" during os.system()? I am using a scientific software including a Python script that is calling `os.system()` which is used to run another scie...

Python subprocess/Popen with a modified environment

Python subprocess/Popen with a modified environment I believe that running an external command with a slightly modified environment is a very common case. That's how I tend to do it: I've got a gut fe...

7 Jan at 03:57

How to get exit code when using Python subprocess communicate method?

How to get exit code when using Python subprocess communicate method? How do I retrieve the exit code when using Python's `subprocess` module and the `communicate()` method? Relevant code: Should I be...

11 Nov at 20:3

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...

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

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

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

Pipe subprocess standard output to a variable

Pipe subprocess standard output to a variable I want to run a command in `pythong`, using the subprocess module, and store the output in a variable. However, I do not want the command's output to be p...

5 Jul at 15:44

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

Start and capture GUI's output from same Python script and transfer variables?

Start and capture GUI's output from same Python script and transfer variables? I have to start a GUI from an existing Python application. The GUI is actually separate Python GUI that can run alone. Ri...

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