Account for the fact that some file-like objects may not have a isatty() method #1022

wants to merge 1 commit into


None yet

1 participant

jphalip commented Nov 16, 2013

This patch is inspired from that of #1019 and addresses a similar issue.

In my case, the issue I'm facing is that the pipe doesn't have an isatty() method when running the fabric.contrib.files.sed command on an Ubuntu 12.04.3 machine:

Traceback (most recent call last):
  File "/home/vagrant/.virtualenvs/myproject/local/lib/python2.7/site-packages/celery/app/", line 218, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/home/vagrant/.virtualenvs/myproject/local/lib/python2.7/site-packages/celery/app/", line 396, in __protected_call__
    return*args, **kwargs)
  File "/vagrant/myproject/myapp/", line 35, in mytask
    sed('/etc/network/interfaces', old_ip, new_ip, use_sudo=True, )
  File "/home/vagrant/.virtualenvs/myproject/local/lib/python2.7/site-packages/fabric/contrib/", line 204, in sed
    platform = run("uname")
  File "/home/vagrant/.virtualenvs/myproject/local/lib/python2.7/site-packages/fabric/", line 578, in host_prompting_wrapper
    return func(*args, **kwargs)
  File "/home/vagrant/.virtualenvs/myproject/local/lib/python2.7/site-packages/fabric/", line 1042, in run
  File "/home/vagrant/.virtualenvs/myproject/local/lib/python2.7/site-packages/fabric/", line 911, in _run_command
    stderr=stderr, timeout=timeout)
  File "/home/vagrant/.virtualenvs/myproject/local/lib/python2.7/site-packages/fabric/", line 737, in _execute
    with char_buffered(sys.stdin):
  File "/usr/lib/python2.7/", line 17, in __enter__
  File "/home/vagrant/.virtualenvs/myproject/local/lib/python2.7/site-packages/fabric/", line 432, in char_buffered
    if win32 or not pipe.isatty():
AttributeError: '_fileobject' object has no attribute 'isatty'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment