subprocess Questions

3

Solved

I want to return only those applications which get listed under "Apps" category in the Windows task manager and NOT all of the running processes. The below script returns all processes which I don'...
Knowling asked 22/2, 2019 at 13:10

6

I am trying to call a python program with subprocess, but I get a permission error. I tried running PyCharm as an admin, but it doesn't help. My code: answer = subprocess.check_output("../folder ...
Conquer asked 16/1, 2020 at 20:15

6

Solved

I have this code: import os import time import asyncio async def run_command(*args): """ Example from: http://asyncio.readthedocs.io/en/latest/subprocess.html ""&quot...
Grappling asked 19/6, 2017 at 14:38

4

Solved

I want to start several subprocesses with a programm, i.e. a module foo.py starts several instances of bar.py. Since I sometimes have to terminate the process manually, I need the process id to pe...
Faden asked 26/11, 2013 at 13:36

2

Solved

I need to call a shellscript from python. The problem is that the shellscript will ask a couple of questions along the way until it is finished. I can't find a way to do so using subprocess! (usin...
Watercourse asked 31/5, 2013 at 10:55

7

Solved

How do I go about running a bash script using the subprocess module, to which I must give several arguments? This is what I'm currently using: subprocess.Popen(['/my/file/path/programname.sh', 'a...
Poulson asked 21/6, 2013 at 19:23

9

Solved

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 the whole of the rest of the line. The code be...
Jello asked 19/7, 2013 at 9:36

2

Solved

I'm trying to create a program that scans a text file and passes arguments to subprocess. Everything works fine until I get directories with spaces in the path. My split method, which breaks down ...
Sayles asked 7/8, 2012 at 12:40

9

Solved

I want to call a process via a python program, however, this process need some specific environment variables that are set by another process. How can I get the first process environment variables ...
Strahan asked 31/7, 2009 at 19:44

14

Solved

My python script uses subprocess to call a linux utility that is very noisy. I want to store all of the output to a log file and show some of it to the user. I thought the following would work, but...
Sequel asked 10/5, 2010 at 16:47

7

Solved

I'm trying to write a Python script that starts a subprocess, and writes to the subprocess stdin. I'd also like to be able to determine an action to be taken if the subprocess crashes. The process...
Eusebiaeusebio asked 12/12, 2011 at 13:46

26

Solved

I'm using a python script as a driver for a hydrodynamics code. When it comes time to run the simulation, I use subprocess.Popen to run the code, collect the output from stdout and stderr into a su...
Persuader asked 24/8, 2013 at 18:27

3

Solved

I am using the subprocess module and check_output() to create a virtual shell in my Python script, and it works fine for commands that return a zero exit status, however for ones that don't it retu...
Pressman asked 18/8, 2012 at 4:10

10

Solved

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: import subprocess, os my_env = os.environ my_env["PATH"] = "/usr/...
Glazier asked 9/2, 2010 at 17:55

5

Solved

I'd like to both capture and display the output of a process that I invoke through Python's subprocess. I thought I could just pass my file-like object as named parameter stdout and stderr I can ...
Charette asked 2/12, 2010 at 13:37

11

When I kick off a python script from within another python script using the subprocess module, a zombie process is created when the subprocess "completes". I am unable to kill this subprocess unles...
Alto asked 3/5, 2010 at 19:29

6

Solved

I've tried running things like this: subprocess.Popen(['nohup', 'my_command'], stdout=open('/dev/null', 'w'), stderr=open('logfile.log', 'a')) This works if the parent script exits gracefully,...
Ragg asked 15/5, 2011 at 21:3

6

Solved

I wrote some statements like below: os.system(cmd) #do something subprocess.call('taskkill /F /IM exename.exe') both will pop up a console. How can I stop it from popping up the console?
Makings asked 10/8, 2011 at 5:21

5

Solved

The child process is started with subprocess.Popen(arg) Is there a way to ensure it is killed when parent terminates abnormally? I need this to work both on Windows and Linux. I am aware of this s...
Messere asked 2/5, 2014 at 18:40

2

Solved

What options are there for commiting and pushing files to github from python? Here are three methods I thought should be feasible so attempted in order: Use pygithub: (Github's python API) to send...
Casaubon asked 28/4, 2018 at 0:59

25

Solved

I want to write a function that will execute a shell command and return its output as a string, no matter, is it an error or success message. I just want to get the same result that I would have go...
Tennison asked 21/1, 2011 at 14:55

1

Solved

My co-worker asked me why his code cannot run in concurrency in multi-threads. I discover the os.system function is acting weird unlike the other functions in multi-threads. I code a small demo to ...
Mindimindless asked 17/11, 2020 at 9:18

4

The need: Timeout after X seconds, and kill the process (and all the processes it opened) if timeout reached before the process ends gracefully. Read ongoing output at runtime. Work with processe...
Keitel asked 6/8, 2016 at 6:20

3

Solved

I have a Python script, which is running as a Windows Service. The script forks another process with: with subprocess.Popen( args=[self.exec_path], stdout=subprocess.PIPE, stderr=subprocess.STDOUT...
Nonappearance asked 18/10, 2016 at 12:51

3

I'm wondering if this is the correct way to execute a system process and detach from parent, though allowing the parent to exit without creating a zombie and/or killing the child process. I'm curre...
Driver asked 24/4, 2011 at 19:55

© 2022 - 2024 — McMap. All rights reserved.