I have used subprocess to obtain the output from command line, but it requires the process to end before you can use the data. Is there a way to get data line by line as it outputs? I need to have a process running indefinitely while python gets each new line as it is printed out.
Asked
Active
Viewed 78 times
0
-
1Possible duplicate of [live output from subprocess command](https://stackoverflow.com/questions/18421757/live-output-from-subprocess-command) – ahota Nov 12 '18 at 03:56
1 Answers
0
If you know the Process ID or PID, You can do subprocess.call('tail -f /proc/<pid>/fd/1')

Piyush Singh
- 2,736
- 10
- 26