Linked Questions
53 questions linked to/from Python C program subprocess hangs at "for line in iter"
0
votes
0
answers
254
views
Python Popen with stdout and stdin piped : read freeze [duplicate]
I'm currently facing a strange problem. I would like to manage the execution of this simple binary with Python:
int main()
{
char test[5];
printf("Reading\n");
fgets(test, 5, ...
1
vote
0
answers
58
views
asyncio readline from c subprocess stdout seems to block on windows [duplicate]
I'm on Windows 10.
I have a program written in c, that simply prints to the stdout and sleeps between prints, emulating some real work. I try to call this program from python (3.7.7) using asyncio and ...
645
votes
33
answers
343k
views
A non-blocking read on a subprocess.PIPE in Python
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 make ...
98
votes
7
answers
111k
views
Read streaming input from subprocess.communicate() [duplicate]
I'm using Python's subprocess.communicate() to read stdout from a process that runs for about a minute.
How can I print out each line of that process's stdout in a streaming fashion, so that I can ...
47
votes
11
answers
15k
views
How do I get 'real-time' information back from a subprocess.Popen in python (2.5)
I'd like to use the subprocess module in the following way:
create a new process that potentially takes a long time to execute.
capture stdout (or stderr, or potentially both, either together or ...
32
votes
4
answers
46k
views
Python subprocess readlines() hangs
The task I try to accomplish is to stream a ruby file and print out the output. (NOTE: I don't want to print out everything at once)
main.py
from subprocess import Popen, PIPE, STDOUT
import pty
...
23
votes
4
answers
30k
views
Python subprocess in parallel
I want to run many processes in parallel with ability to take stdout in any time. How should I do it? Do I need to run thread for each subprocess.Popen() call, a what?
9
votes
4
answers
16k
views
Python 3.4.3 subprocess.Popen get output of command without piping?
I am trying to assign the output of a command to a variable without the command thinking that it is being piped. The reason for this is that the command in question gives unformatted text as output if ...
13
votes
1
answer
11k
views
How to avoid the deadlock in a subprocess without using communicate()
proc = subprocess.Popen(['start'],stdin=subprocess.PIPE,stdout=subprocess.PIPE)
proc.stdin.write('issue commands')
proc.stdin.write('issue more commands')
output = proc.stdout.read() # Deadlocked ...
5
votes
2
answers
10k
views
Python: Nice way to iterate over shell command result
is there a "nice" way to iterate over the output of a shell command?
I'm looking for the python equivalent for something like:
ls | while read file; do
echo $file
done
Note that 'ls' is only an ...
6
votes
1
answer
15k
views
Read console output of another program in Python
There are two programs - parent.py and myscript.py, shown below. parent.py keeps printing messages in the console. And myscript.py needs access to what parent.py prints.
parent.py:
import time
...
5
votes
3
answers
7k
views
Real time output of subprocess.popen() and not line by line
I'm currently rewriting a little wrapper program in python that I once wrote in C++. It extracts files from a file and boxes them in another format.
In C++ the output from the system commands I need ...
4
votes
2
answers
15k
views
Reading from a stdout in real time using node.js
I have a problem, I need to read from a console output in real time. I have a file that I need to execute, tried doing something like this test.exe > text.txt but when I try to read while exe file ...
10
votes
3
answers
8k
views
subprocess.Popen handling stdout and stderr as they come
I'm trying to process both stdout and stderr from a subprocess.Popen call that captures both via subprocess.PIPE but would like to handle the output (for example printing them on the terminal) as it ...
5
votes
1
answer
11k
views
Is it possible to stream output from a python subprocess to a webpage in real time?
Thanks in advance for any help. I am fairly new to python and even newer to html.
I have been trying the last few days to create a web page with buttons to perform tasks on a home server.
At the ...