I'm using paramiko to manage cisco devices remotely.  It works
beautifully when I have a script open a connection to a device,
execute a command, then close the connection.  However, if I connect
and then attempt to execute a command, and then a second command, an
error is thrown.  Here's a simple script that shows exactly what I'm
talking about:

#!/usr/bin/env python

import paramiko
import os

def main():
    paramiko.util.log_to_file("err.log")
    client = paramiko.SSHClient()
    client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
    client.connect("x.x.x.x", 22, "username", "password")
    (stdin, stdout, stderr) = client.exec_command('show version')
    (stdin, stdout, stderr) = client.exec_command('show version')
    data = stdout.read()
    print data
    client.close()

if __name__ == '__main__':
    main()

If I comment out the second client.exec_command() line, there are no
problems.  Any tips to get this to work correctly?

-- 
"The presence of those seeking the truth is infinitely to be preferred
to the presence of those who think they've found it."

–Terry Pratchett

_______________________________________________
paramiko mailing list
[email protected]
http://www.lag.net/cgi-bin/mailman/listinfo/paramiko

Reply via email to