so I'm trying to get paramiko to actively print output in the ssh session i created, instead it seems to wait till the program is done and dumps all the output at once. tried a solution that is blocked out in my code that did not seem to work.
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 11 18:01:47 2022
@author: GigaGame
"""
import paramiko
hostnamefil ="192.168.0.120"
portfil =22
userfil="***"
passsfil="***"
def filterwheel():
try:
client=paramiko.SSHClient()
client.load_system_host_keys()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect(hostnamefil,port=portfil,username=userfil,password=passsfil)
while True:
try:
print("Welcome to the Filter Wheel")
print("Type exit to quit the program.")
cmd = "python3 ./Software/MTS/filter_wheel/fw102c_control.py"
#cmd = input("$> ")
if cmd == "exit": break
stdin, stdout, stderr=client.exec_command(cmd)
#sys.stdout.read(paramiko.Transport((hostnamefil, 22)).open_session().recv(1))
print ("main:: Begin program..."
"Residual System Status: startup"
"Please address errors. Continue? (Y/N)")
in1=input("$> ")
if in1=="exit":break
stdin.write(in1 + '\n')
stdin.flush()
print (stdout.read().decode())
print (stderr.read().decode())
except KeyboardInterrupt:
break
client.close()
except Exception as err:
print(str(err))
filterwheel()