python netminko TypeError:'type' object不可迭代

运行一个简单的脚本来备份L2启动配置我总是得到这种类型的输出引用TypeError:

找不到处理程序“paramiko.transport”Traceback(最近一次调用最后一次):文件“hp_tftp.py”,第108行,在net_connect = ConnectHandler(** a_device)文件“/ usr / local / lib / python2 .7 / dist-packages / netmiko-1.5.1-py2.7.egg / netmiko / ssh_dispatcher.py“,第167行,在ConnectHandler中返回ConnectionClass(* args,** kwargs)文件”/ usr / local / lib / python2.7 / dist-packages / netmiko-1.5.1-py2.7.egg / netmiko / base_connection.py“,第187行,在init self.establish_connection()文件”/usr/local/lib/python2.7/ dist-packages / netmiko-1.5.1-py2.7.egg / netmiko / base_connection.py“,第650行,在establish_connection中self.remote_conn_pre.connect(** ssh_connect_params)文件”/usr/local/lib/python2.7 /dist-packages/paramiko/client.py“,第392行,在连接t.start_client(timeout = timeout)文件”/usr/local/lib/python2.7/dist-packages/paramiko/transport.py“,行545,在start_client中引发e类型错误:'type'对象不可迭代

这是代码:

for a_device in all_devices:
	net_connect = ConnectHandler(**a_device)
	print("----------------------------------------BEGIN----------------------------------------")
	print ("\n\n>>>>>>>>> Copying Config {0} to TFTP Server <<<<<<<<<".format(a_device['device_type']))
	net_connect.send_command("copy startup-config tftp [ip_server] pdy.sw.l2.-{0}-{1}".format(a_device['ip'],date))
	time.sleep(1)
	print ("\n\n>>>>>>>>> Startup-Config Has Been Sent {0} <<<<<<<<<".format(a_device['ip']))
	print ("\n\n----------------------------------------END----------------------------------------\n\n")

108线来自 net_connect = ConnectHandler(**a_device)

回答(0)