[paramiko] what is the exception if sftp object dies

Todd Whiteman toddw at activestate.com
Thu Mar 22 14:35:14 PDT 2007


Not sure what the exact exception is, but it's probably better to check 
the connection before you perform the sftp.read() using something like:

if not connection.is_active():
   reconnect()
sftp.read()


Note: Any error(s) is likely one of:
   paramiko.SFTPError
   IOError
   socket.error


Cheers,
Todd


Manpreet Singh Khurana wrote:
> Hi,
>     I am doing sftp transport connection by doing
> 
> sftp = paramiko.SFTP.from_transport(tc)
> 
> on this sftp object i do all the read and write operation for a file.
> 
> Now if for some reason the SFTP connection is gone and if we are
> trying to do something like
> sftp.read() operation, this will fail since there no sftp connection alive
> 
> In this case what sort of exception is returned?
> 
> Actually i need to catch this and try SFTP connection again.
> 
> Manpreet
> 
> _______________________________________________
> paramiko mailing list
> paramiko at lag.net
> http://mail.lag.net/mailman/listinfo/paramiko
> 




More information about the paramiko mailing list