Category "subprocess"

Subprocess loop in python

I have a folder with a few hundred .bed files that I want to loop over to extract fasta sequences. In the terminal, my command is: twoBitToFa -bed=PA2_03_2bit.b

Subprocess loop in python

I have a folder with a few hundred .bed files that I want to loop over to extract fasta sequences. In the terminal, my command is: twoBitToFa -bed=PA2_03_2bit.b

How keep tracking the external program opened in python?

I want open a program (ex: calculator) and keep tracking his process as the pid, name, etc. But, after calling the subprocess.Popen(), the process id is killed

use subprocess.run with check = True where the command is expected to return a non-zero exit code

When using subprocess.run it's recommended to use check = True (https://pycodequ.al/docs/pylint-messages/w1510-subprocess-run-check.html). However, there might

Why use devnull with subprocess.check_output in python2?

I have inherited a complicated (to me) toolbox from a PhD student before me and it uses python2 instead of 3 since it's older. The main file is in python2 and u

Why does subprocess stdout only produce one line when the process is killed with os.kill()?

I have a piece of code that opens a subprocess and writes the output to a file: logPath = '/path/to/some/directory/' log = open(logPath + 'log', 'a') guipid

Terminate child process on subprocess.TimeoutExpired

I have the following snippet of code: def terminal_command(command, timeout=5*60): """Executes a terminal command.""" cmd = command.split("

Open (and run) a new Python file by a Python file

I need to run a second python file (2) using a first Python file (1) and I need that the first file continue to be runned. For example: I have the file A.py and

Run a while-loop as subprocess in background

Unhappily my last post was marked as duplicate and my problem wasn't solved. So I've to phrase it a little bit different. Below you can see my main-file(SP_Tes

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