There are several network devices. The connection is established with each of them in turn. When there is a connection, a sign should appear - ok, when not - no. The problem is when there is no connection with one device, the waiting time expires, and the program simply does not reach the appearance of a window with "no". How can I limit the time in the code to wait for a response from the device, break the connection establishment? For example, if 5 seconds has passed and there is no answer, display such a window. The code is below. I use python3 and paramiko, Windows7.
ssh = SSHConfig() params = ssh.lookup(user_password_rnm) ssh = SSHClient() ssh.set_missing_host_key_policy(AutoAddPolicy()) ssh.connect(ipAddress_rnm, port=22, username=user_name_rnm, password=user_password_rnm) if ssh.invoke_shell(): st = ['with: ', name_rnm, ' - OK'] showinfo('Connection', ' '.join(st)) ssh.close() else: st = ['with: ', name_rnm, ' - NO CONNECT'] showinfo('Connection', ' '.join(st)) in if an error "timeout expired" occurs and the execution of the program does not reach else. How to make NO CONNECT window appear?