我正在尝试使用以下代码连接ssh服务器
ssh = paramiko.SSHClient()
ssh.load_system_host_keys()
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
ssh.load_host_keys(os.path.expanduser(os.path.join("~", ".ssh", "known_hosts"))
ssh.connect("10.1.3.2", username = "root")
但是我收到以下错误消息
Exception during testMethod !!
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/Qb/QbUnittest/QbUnittest.py", line 624, in __call__
testMethod()
File "testDropBear_send_file.py", line 31, in runMe
ssh.connect("10.1.3.2", username = "root")
File "/usr/local/lib/python2.7/dist-packages/paramiko-1.12.0-py2.7.egg/paramiko/client.py", line 326, in connect
self._policy.missing_host_key(self, server_hostkey_name, server_key)
File "/usr/local/lib/python2.7/dist-packages/paramiko-1.12.0-py2.7.egg/paramiko/client.py", line 71, in missing_host_key
client.save_host_keys(client._host_keys_filename)
File "/usr/local/lib/python2.7/dist-packages/paramiko-1.12.0-py2.7.egg/paramiko/client.py", line 192, in save_host_keys
if self.known_hosts is not None:
AttributeError: 'SSHClient' object has no attribute 'known_hosts'
有人可以帮我理解是什么问题吗?