Executing input() after Kathara.get_instance().connect_tty() : EOFError #295
-
Hello ! I'm a new user of Kathara and the python API. I'm trying to do a python3 script where I run a custom client to interact with the different devices from the lab. Basically it's just a loop where I do an def run_client(self):
print("Starting lab ...")
Kathara.get_instance().deploy_lab(lab=self.lab)
print("Enter the router name to connect to it or \"exit\".")
print("When you are connected to a device, you can enter \"exit\" to return to the main client.")
while True:
entered = input("> ")
if entered == "exit":
return
m_exists = False
for m in self.lab.machines.items():
if entered == m[0]: m_exists = True
if not m_exists:
print(f"Error : no device named \"{entered}\"")
else:
print(f"Connecting to device \"{entered}\" ...")
Kathara.get_instance().connect_tty(entered, lab_name=self.lab.name) The error I got:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
I got a solution by re-opening the stdin: sys.stdin = open("/dev/tty")
user_input = input("> ") |
Beta Was this translation helpful? Give feedback.
I got a solution by re-opening the stdin: