0

I'm trying to display realtime data using subprocess module, But it only display first line only. I tried to follow some of the tutorials. which are given here

read subprocess stdout line by line

Code i tried

import subprocess
proc = subprocess.Popen(
    ['aria2c', 'http://cdimage.deepin.com/releases/20Beta/deepin-20Beta-desktop-amd64.iso'], stdout=subprocess.PIPE)
while True:
    line = proc.stdout.readline()
    if not line:
        break
    # the real code does filtering here
    print("test:", line.rstrip())

Actual Output

Display only one line

Expected Output

display all the informations

pyDev
  • 11
  • 1
  • `aria2c` is *also* writing to standard error, which you are not capturing. – chepner Apr 23 '20 at 17:16
  • Which operating system? On unix-like systems, the problem may be solved with a `pty` to make the program think it is running in a terminal. – tdelaney Apr 23 '20 at 17:20

0 Answers0