[paramiko] no existing session

Todd Whiteman toddw at activestate.com
Fri Jul 27 09:40:54 PDT 2007


Chris Hallman wrote:
> 
> I'm trying to write a program that connects to a Cisco router to run 
> multiple commands and collect data. I've tried the following:
> 
> import socket
> import paramiko
> 
> sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> sock.connect((''rtr3926', 22))
> 
> trans = paramiko.Transport(sock)
> trans.auth_password('user', 'password')
> 
> and I receive this error:
> 
>  >pythonw -u "paramiko.test.py <http://paramiko.test.py/>"
> Traceback (most recent call last):
>   File " paramiko.test.py <http://paramiko.test.py/>", line 10, in <module>
>     trans.auth_password('####', '####')
>   File "c:\python25\Lib\site-packages
> \paramiko\transport.py", line 1096, in auth_password
>     raise SSHException('No existing session')
> paramiko.SSHException: No existing session
>  >Exit code: 1
> 
> Any ideas why I'm receiving this error?
> 
> 

Hi Chris,

You need to start the client session, i.e.

trans = paramiko.Transport(sock)
trans.start_client()  # negotiate with the server
trans.auth_password('user', 'password')

Check out the demos that are included in the paramiko source for more 
examples.

Cheers,
Todd



More information about the paramiko mailing list