运行一个简单的脚本来备份L2启动配置我总是得到这种类型的输出引用TypeError:
找不到记录器“paramiko.transport”的处理程序 Traceback(最近一次调用最后一次): 文件“hp_tftp.py”,第108行,in net_connect = ConnectHandler(** a_device) ConnectHandler中的文件“/usr/local/lib/python2.7/dist-packages/netmiko-1.5.1-py2.7.egg/netmiko/ssh_dispatcher.py”,第167行 return ConnectionClass(* args,** kwargs) 在 init 中输入文件“/usr/local/lib/python2.7/dist-packages/netmiko-1.5.1-py2.7.egg/netmiko/base_connection.py”,第187行 self.establish_connection() 在build_connection中输入文件“/usr/local/lib/python2.7/dist-packages/netmiko-1.5.1-py2.7.egg/netmiko/base_connection.py”,第650行 self.remote_conn_pre.connect(** ssh_connect_params) 在连接文件“/usr/local/lib/python2.7/dist-packages/paramiko/client.py”,第392行 t.start_client(超时=超时) 在start_client中输入文件“/usr/local/lib/python2.7/dist-packages/paramiko/transport.py”,第545行 提高e TypeError:'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)