python - Paramiko error "missing_host_key() missing 1 required positional argument: 'key'" -


my code:

#!/usr/bin/env python3  paramiko.client import sshclient, warningpolicy  host_name = "********" user_name = "********" passwd = "********"  def ssh_setup():     client = sshclient()     client.load_system_host_keys()     client.set_missing_host_key_policy(warningpolicy)     client.connect(host_name, 22, user_name, passwd)     return client  def main():     client = ssh_setup()     client.exec_command("display=:0.0 notify-send \"test\"")     client.close()  if __name__ == "__main__":     main() 

when ran, following error:

traceback (most recent call last):   file "./test", line 30, in <module>     main()   file "./test", line 25, in main     client = ssh_setup()   file "./test", line 20, in ssh_setup     client.connect(host_name, 22, user_name, passwd)   file "/usr/local/lib/python3.4/dist-packages/paramiko/client.py", line 348, in connect     server_key) typeerror: missing_host_key() missing 1 required positional argument: 'key' 

i can ssh machine in question fine (i mean, "i don't need enter password" fine)

you need pass warningpolicy object set_missing_host_key_policy

client.set_missing_host_key_policy(warningpolicy()) 

Comments