On Wed, Oct 14, 2009 at 2:53 PM, Nathan Farrar <[email protected]> wrote: > 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?
Is the error about the connection being closed? I vaguely remember something about cisco's ssh server always closing the connection after one command (be it a login, or a single command). -jim _______________________________________________ paramiko mailing list [email protected] http://www.lag.net/cgi-bin/mailman/listinfo/paramiko
