Hi All, I need help with the below mentioned script. The second time I call a.execute, self.transport.open_session() fails with an EOF error. Is this a paramiko bug or am I doing something wrong?
import paramiko class Connection(object): def __init__(self, host, username = None, password = None, private_key = None, \ port = 22): self.transport = paramiko.Transport((host, port)) self.live = True self.transport.connect(username = username, password = password) def execute(self, command): channel = self.transport.open_session() channel.exec_command(command) output = channel.makefile('rb', -1).readlines() if output: print output else: print channel.makefile_stderr('rb', -1).readlines() def close(self): if self.live: self.transport.close() self.live = False def __del__(self): self.close() if __name__ == '__main__': a= Connection('ip_or_hostname', 'root', '') print a.execute('version') print a.execute('version') print a.execute('version') a.close() Regards, Jacob Abraham -- http://mail.python.org/mailman/listinfo/python-list