subprocess Questions

4

Solved

I'm trying to generate a requirements.txt file programatically. This way I can diff it against a second .txt file. So far I've tried the following, but they only output the requirements to console ...
Powel asked 20/6, 2014 at 7:18

6

Solved

I would like to execute multiple commands in a row: i.e. (just to illustrate my need): cmd (the shell) then cd dir and ls and read the result of the ls. Any idea with subprocess module? Up...
Naxos asked 11/12, 2008 at 13:30

5

Solved

I need to do something like this post, but I need to create a subprocess that can be given input and give output many times. The accepted answer of that post has good code... from subprocess impor...
Annunciate asked 19/2, 2015 at 20:13

4

Solved

I need to launch a number of long-running processes with subprocess.Popen, and would like to have the stdout and stderr from each automatically piped to separate log files. Each process will run si...
Simdars asked 25/2, 2010 at 3:8

2

Solved

I have a executable which requires a tty (as stdin and stderr), and want to be able to test it. I want to input stdin, and capture the output of stdout and stderr, here's an example script: # test...
Premillenarian asked 23/10, 2018 at 16:56

6

I've been trying to understand for a while now what's the difference between subprocess.call and subprocess.run. I know the last one is new on Python 3.5 and both are based on subprocess.Popen, but...
Northernmost asked 19/11, 2016 at 20:30

32

Solved

I'm using the subprocess module to start a subprocess and connect to its output stream (standard output). I want to be able to execute non-blocking reads on its standard output. Is there a way to m...
Langtry asked 17/12, 2008 at 17:56

11

Solved

I am using subprocess to call another program and save its return values to a variable. This process is repeated in a loop, and after a few thousands times the program crashed with the following er...
Ichabod asked 13/5, 2013 at 16:23

2

Solved

I have the class InternalProc, defined as following: class InternalProc: @staticmethod def get_data(): try: result = subprocess.run(['bridge-client', '--business-credentials'], stdout=subproc...
Bludgeon asked 23/2, 2021 at 11:11

10

Solved

I'm currently launching a programme using subprocess.Popen(cmd, shell=TRUE) I'm fairly new to Python, but it 'feels' like there ought to be some api that lets me do something similar to: subproce...
Sexdecillion asked 5/4, 2010 at 23:45

2

Solved

I found a number of questions which looks like mine, but which did not produce a solution I can use (closest is: subprocess output to stdout and to PIPE) The problem: I want to start a process usi...
Supposing asked 10/4, 2015 at 9:38

9

Solved

I've looked at a number of questions but still can't quite figure this out. I'm using PyQt, and am hoping to run ffmpeg -i file.mp4 file.avi and get the output as it streams so I can create a progr...
Milicent asked 3/10, 2011 at 8:20

3

Solved

I have a some Python code that occasionally needs to span a new process to run a shell script in a "fire and forget" manner, i.e. without blocking. The shell script will not communicate with the or...
Kilt asked 17/12, 2013 at 23:7

4

Solved

I am trying to use the subprocess module in Python to communicate with a process that reads standard input and writes standard output in a streaming fashion. I want to have the subprocess read line...
Manolete asked 31/7, 2011 at 22:5

4

Solved

Is it possible to modify code below to have printout from 'stdout 'and 'stderr': printed on the terminal (in real time), and finally stored in outs and errs variables? The code: #!/usr/bin/pyt...
Meniscus asked 19/6, 2013 at 11:38

3

Solved

I am using the subprocess module like that: ping = subprocess.Popen('fping.exe 192.168.2.3 196.65.58.69', stdout=PIPE) output = ping.stdout.readlines() I am need the output list in order to proc...
Nadiya asked 25/3, 2012 at 10:28

6

I'm using subprocess to run a command line program from a Python (3.5.2) script, which I am running in a Jupyter notebook. The subprocess takes a long time to run and so I would like its stdout to ...
Evangelist asked 27/7, 2016 at 14:36

4

Solved

I am using Python and it's subprocess library to check output from calls using strace, something in the matter of: subprocess.check_output(["strace", str(processname)]) However, this only gives...
Scrapbook asked 8/1, 2019 at 11:59

5

Solved

I am looking for the way to call shell scripts from python and write their stdout and stderr to file using logging. Here is my code: import logging import tempfile import shlex import os def run_...
Anamorphosis asked 22/2, 2014 at 11:44

7

Solved

I have a small issue that I'm not quite sure how to solve. Here is a minimal example: What I have scan_process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) while(so...
Toulon asked 25/5, 2012 at 14:38

3

Details error message:- FileNotFoundError [WinError 2] The system cannot find the file specified at ~\AppData\Local\Programs\Python\Python39\lib\subprocess.py:1582 in _execute_child 1578│ sys...
Surinam asked 1/8, 2022 at 11:42

2

Solved

I was reading up on Python Memory Management and would like to reduce the memory footprint of my application. It was suggested that subprocesses would go a long way in mitigating the problem; but i...
Hight asked 29/5, 2014 at 15:38

6

Solved

I am using: grepOut = subprocess.check_output("grep " + search + " tmp", shell=True) To run a terminal command, I know that I can use a try/except to catch the error but how can I get the value ...
Friendship asked 2/5, 2014 at 4:54

5

I have some custom commands. This works: subprocess.Popen(['python'], stdout=subprocess.PIPE) But if I have my own system commands like deactivate, I get that error Traceback (most recent call las...
Henna asked 29/3, 2012 at 23:38

4

Solved

After I went through the documentation for Node.js Child Processes, I was curious If it would be possible to pass a Buffer to this Process. https://nodejs.org/api/child_process.html For me it see...
Boarish asked 19/6, 2015 at 12:6

© 2022 - 2024 — McMap. All rights reserved.