Category "subprocess"

Have subprocess.Popen only wait on its child process to return, but not any grandchildren

I have a python script that does this: p = subprocess.Popen(pythonscript.py, stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=False) theStdin=request.input.encode('

How to read/extract contents of .tar.7z file using python

I have a .tar.7z file which I want to unpack (when I unpack with archive_utility.app on MAC manually, I am getting a folder with subfolder and files). I am not

How can I tell subprocess to answer "y" to a commandline question?

I'm automating an ffmpeg command but when the file exists already, it asks me if I have to "Overwrite [y/N]" and it stalls the entire script until I have to ent

Kivy not opening new window on button press? (Subprocess/Popen, Python)

I am trying to open a new window upon a button press with kivy. However, when I try to open the file with the separate window in it, it simply doesn't do anythi

Watch stdout and stderr of a subprocess simultaneously

How can I watch standard output and standard error of a long-running subprocess simultaneously, processing each line as soon as it is generated by the subproces

Check if pip is installed on Windows using python subprocess

I am using python to check whether pip is installed on the system or not. The code I have written is : subprocess.run(["pip"],shell=True) and I am getting t

Windows CMD life parsing (reading) and filter output with Python

I open CMD in Windows, go to C:\Users\OM\Downloads\DCS-COINS\Munt.G_DCS-COINS\ and there run command DCS-COINS -v and then I get instantly moving lines with inf

Wait subprocess.run until completes its task

I have created a simple method that executes a command like you do in the terminal from subprocess import PIPE, run class Command_Line(): @staticmethod

Run code after subprocess calls a program?

I am trying to add code after I successfully open a program with a subprocess, but it's not working. Can anyone tell me why? import win32api, win32con i

Run code after subprocess calls a program?

I am trying to add code after I successfully open a program with a subprocess, but it's not working. Can anyone tell me why? import win32api, win32con i

How to PIPE the output from a subprocess.Popen, while communicating to it at later point?

Okay, here's what I need to do. I'm trying to PIPE the output from Popen, to display it in real time. However, I need to communicate with my process while it is

python subprocess can’t print last line with PIPE

p =Popen('cmd.exe',shell=True,stdin=PIPE,stdout=PIPE,bufsize=0) def run(): global p while True: line = p.stdout.read(1) if not line: #

How can subprocess be used in a class and tested in python

I have an executable that has many options and I wish to create classes. e.g. the exec has options that can copy rows of a file, rename parts of a file, compres

Parallelizing different functions at the same time in python

I want to execute f1 and f2 at the same time. but the following code doesn't work! from multiprocessing import Pool def f1(x): return x*x def f2(x): return x

IPython - pipe multiple subprocesses and show result of final one to stdout

There are a lot of questions related to this one but none seems to work for my case: 1-https://stackoverflow.com/questions/9655841/python-subprocess-how-to-use-

Using subprocess.check_output for a command with 2>/dev/null

I am on Mac OS X Yosemite 10.10 and Python 2.7. If I type the following: du -g -d1 /Users 2> /dev/null in the command line, everything works perfectly. No

How to fix wmctrl Cannot open display when Python open subprocess

This is my program, and it works very well. import subprocess result = subprocess.check_output("wmctrl -l",shell=True,stderr=subprocess.STDOUT) result = resul

Python subprocess.Popen() not running command

I'm trying to use subprocess.Popen() to run a command in my script. The code is: output = Popen(["hrun DAR_MeasLogDump " + log_file_name], stdout=subprocess.PI

subprocess.Popen Argument list is too long

I use proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE,

How to run Python subprocess and stream but also filter stdout and stderr?

I have a server-like app I want to run from Python. It never stops until user interrupts it. I want to continuously redirect both stdout and stderr to parent wh