python 结构错误找不到记录器“paramiko.transport”的处理程序
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1797925/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Fabric error No handlers could be found for logger "paramiko.transport"
提问by BryanWheelock
I'm not sure why I'm getting this error that's terminating my connection. I updated paramiko-1.7.6 from 1.7.5 via easy_install.
我不确定为什么我会收到终止连接的错误。我通过easy_install从1.7.5更新了paramiko-1.7.6。
I'm trying to setup Fabric to upload my Django app to my server. The error seems to be happening when I attempt to make a backup of the existing app directory:
我正在尝试设置 Fabric 以将我的 Django 应用程序上传到我的服务器。当我尝试备份现有应用程序目录时,错误似乎发生了:
def backup_current_install():
now = datetime.datetime.now()
cmd="cp -r /home/path/django-projects/app /home/path/django-projects/app%s" % now.strftime("%Y%m%d_%I:%M:%S")
run(cmd)
I have set:
我已经设定:
env.hosts
env.password
In the fabfile and I'm not sure how to navigate this handler error.
在 fabfile 中,我不确定如何导航此处理程序错误。
回答by BryanWheelock
It turns out that this error was a result of me not configuring env.passwordas a simple string.
事实证明,这个错误是因为我没有将env.password配置为一个简单的字符串。
Both env.userand env.passwordshould be simple strings, not Lists. Documentation
无论env.user和env.password应该是简单的字符串,而不是列表。 文档
回答by JimB
If it's not causing a problem, you can safely ignore this message.
如果它没有引起问题,您可以放心地忽略此消息。
In this case, the library (paramiko), expects the application to handle the logging. The application programmer however probably expected the library to not have any side effects, and handle logging properly.
在这种情况下,库 (paramiko) 期望应用程序处理日志记录。然而,应用程序程序员可能希望该库没有任何副作用,并正确处理日志记录。
See Configuring Logging for a Library.
请参阅为库配置日志记录。
回答by Mateusz Kleinert
In addition to the previous answers:
除了之前的答案:
If you want to find a root cause of the error in your application it's useful to enable logging which was signalized by the message:
如果您想找到应用程序中错误的根本原因,启用由消息表示的日志记录会很有用:
Fabric error No handlers could be found for logger “paramiko.transport”
结构错误找不到记录器“paramiko.transport”的处理程序
You can enable logging from paramico in fabric like this:
您可以在结构中从 paramico 启用日志记录,如下所示:
from fabric.network import ssh
ssh.util.log_to_file("paramiko.log", 10)