[paramiko] Testing an exception

Todd Whiteman toddw at activestate.com
Tue Aug 7 10:43:28 PDT 2007


Hi Jay,

You get this exception from connecting to a remote machine on a non-ssh 
port, so when Paramiko tries to read in the relevant SSH information, it 
fails and raises the SSHException you received.

A simple repro example is to try and connect to the ftp port (port 21) 
instead of the SSH port (port 22).

Cheers,
Todd

jay wrote:
> Hello,
>  
> Like to start off saying paramiko is fantastic and has been a huge time 
> saver for me at work.  Thanks for the hard work!
>  
> I got the following traceback and am unsure what the problem is.
>  
> Traceback (most recent call last):
>   File "ATM.py", line 115, in <module>
>     t.connect(username=sftpRemoteUser, password=sftpRemotePassword)
>   File 
> "/usr/local/python251/lib/python2.5/site-packages/paramiko/transport.py", 
> line 931, in connect
>     self.start_client()
>   File 
> "/usr/local/python251/lib/python2.5/site-packages/paramiko/transport.py", 
> line 398, in start_client
>     raise e
> SSHException: Error reading SSH protocol banner
>  
> I thought my code would catch all exceptions, but apparently not.  This 
> particular problem showed up inside this
>  
> try:
> except Exception, e:
>  
> So, I would like to try and duplicate it, but I'm not even sure what the 
> problem was.  Any suggestions on how to duplicate this problem and make 
> sure the code catches it?  Thanks
> 
>  Jay
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> paramiko mailing list
> paramiko at lag.net
> http://mail.lag.net/mailman/listinfo/paramiko




More information about the paramiko mailing list