6

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.

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:

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.

BryanWheelock
  • 12,146
  • 18
  • 64
  • 109
  • Can you please post the full exception or warning text that is causing the program to exit or terminating your connection? – jathanism Nov 25 '09 at 16:49
  • Where would I find this information? The snippet I copied is all I'm seeing. – BryanWheelock Nov 25 '09 at 17:55
  • When you execute `run(cmd)` in your script, what is the output you are seeing? Is it displayed as a warning or an error? – jathanism Nov 25 '09 at 18:07
  • The reason "no handlers could be found" is described here: http://stackoverflow.com/questions/19152578/no-handlers-could-be-found-for-logger-paramiko – kkurian Oct 31 '13 at 17:07
  • I get this problem when one of the servers in env.roledefs list is not responding. – MagicLAMP Nov 13 '17 at 04:00

3 Answers3

9

It turns out that this error was a result of me not configuring env.password as a simple string.

Both env.user and env.password should be simple strings, not Lists. Documentation

BryanWheelock
  • 12,146
  • 18
  • 64
  • 109
2

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.

See Configuring Logging for a Library.

tshepang
  • 12,111
  • 21
  • 91
  • 136
JimB
  • 104,193
  • 13
  • 262
  • 255
  • 4
    It's more likely the other way around - your connection is being terminated, and paramiko is attempting to log the error. That message is printed to the console, but there isn't any exception raised. – JimB Nov 25 '09 at 19:27
  • 3
    "you can safely ignore this message." This is not necessarily true. The output can be meaningful and show an error in your program. To figure out the error message, you can insert `import logging; logging.getLogger('paramiko.transport').addHandler(logging.StreamHandler())` at the top of your fabfile and it will display the log message. – sitaktif Jun 21 '14 at 17:31
  • @sitaktif: wow, this was a while ago. Yeah, I probably should have elaborated on "if it's not causing a problem". IIRC paramiko at this time would log innocuous messages with no handler, triggering this logging error. – JimB Jun 21 '14 at 19:07
2

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”

You can enable logging from paramico in fabric like this:

from fabric.network import ssh

ssh.util.log_to_file("paramiko.log", 10)
Mateusz Kleinert
  • 1,316
  • 11
  • 20