Skip to content Skip to sidebar Skip to footer

Real-time Reading Of Terminal Output From Server

I'm trying to process images from my camera on my server and get the information after processing on my local machine in real-time. I can get necessary information as terminal outp

Solution 1:

Since the output is going to be line buffered since you use bufsize=1, then you could just do:

cmd="sshpass -p 'pass' ssh -Y user@ip -t 'process_image; bash -l'"
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, bufsize=1)
for line in p.stdout:
    print(line)
    .....

Of course, this assumes your command is giving you the output you expect.


Post a Comment for "Real-time Reading Of Terminal Output From Server"