How to timeout sftp.put() with signal Module or other ? - Python
问题 I would like timeout the function sftp.put(), I have tried with signal Module but the script doesn't die if the upload time is over 10s. I use that to transfer files by ssh (paramiko). [...] def handler(signum, frame): print 'Signal handler called with signal', signum raise IOError("Couldn't upload the fileeeeeeeeeeee!!!!") [...] raspi = paramiko.SSHClient() raspi.set_missing_host_key_policy(paramiko.AutoAddPolicy()) raspi.connect(ip , username= "", password= "" , timeout=10) sftp = raspi