Python Forum

Full Version: 'SSHClient' object is not callable
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi! Can anyone help me to fix the below error? Thanks!

Error:
File "", line 12, in <module> ssh_client(IP,port=22, username='admin', password='cisco') TypeError: 'SSHClient' object is not callable
import paramiko
with open('network/routers') as f:
        for IP in f:
                ssh_client=paramiko.SSHClient()
                ssh_client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
                ssh_client(IP,port=22, username='admin', password='cisco')

                stdin, stdout, stderr = ssh_client.exec_command('show version')
                output=stdout.read().decode()
                print(output)
                with open(IP + '_output.txt', 'w') as f:
                        f.write(output)
                
                ssh_client.close()
Did you mean to call ssh_client.connect(IP,port=22, username='admin', password='cisco')?