tkinter gui freezes when function fails tkinter gui freezes when function fails tkinter tkinter

tkinter gui freezes when function fails


I believe the issue is with your paramiko ssh connect method call. The method takes an optional timeout argument, but the timeout is set to None by default and is thus never returning. If you set this value to something more reasonable for the user, something like 5 seconds (you may want to set that a bit longer in practice):

# Verify connectivity/authenticate.    try:        ssh.connect(host, username=user, password=passwd, timeout=5)

Now you'll notice you'll hit your except clause. The exception message will be 'timed out' so you can add a check for that there.

Also, it's not a bad idea to wrap functions like that within a GUI in a Thread to prevent the whole app from freezing, it's pretty easy to implement. In your case, you could do something like rename your current log_check function to _log_check and then write a little wrapper like:

def log_check(self):    t = Thread(target=_log_check)    t.start()

Hope this helps!