New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OSError running Fabric from source on non-git systems #749

bitprophet opened this Issue Oct 9, 2012 · 2 comments


None yet
1 participant

bitprophet commented Oct 9, 2012


from fabric.api import local
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/data/data/",
line 9, in <module>
    from fabric.context_managers import cd, hide, settings, show,
path, prefix, lcd
  File "/data/data/",
line 38, in <module>
    from fabric.state import output, win32
  File "/data/data/",
line 10, in <module>
    from fabric.version import get_version
  File "/data/data/",
line 101, in <module>
    __version__ = get_version('short')
  File "/data/data/",
line 52, in get_version
    sha = git_sha()
  File "/data/data/",
line 22, in git_sha
  File "/data/data/",
line 679, in __init__
    errread, errwrite)
  File "/data/data/",
line 1228, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

This example comes from an Android system lacking pip or git binaries. I believe the error is legit, as we simply call subprocess.Popen("git xxx"), which should AFAIK blow up on any system lacking Git.

Why this didn't come up before now is probably due to the following:

  • This function is only called at install time or during fab --version (and --version is likely rarely invoked)
  • Most devs have Git installed somewhere, in which case this will not blow up even if they're not running in a Git checkout (instead, the Popen call will just register a nonzero exit). This is why the call does git_sha() or xxx.

EDIT: Except that should still result in a shell level error (eg bash: git: file not found) and not OSError -- so this might meant Popen itself cannot open the shell it's trying to use (should be /bin/sh by default). Which makes a lot more sense on Android vs other systems.

Fix should be a simple try/except either way.

@bitprophet bitprophet closed this in e09df71 Oct 9, 2012

@bitprophet bitprophet reopened this Oct 9, 2012


This comment has been minimized.


bitprophet commented Oct 9, 2012

local() itself is obviously going to have the same problem...duh!


This comment has been minimized.


bitprophet commented Oct 9, 2012

And there's no graceful workaround for that angle, local simply cannot work in that situation until we tackle #178. Pinning to that guy.

bitprophet added a commit that referenced this issue Oct 9, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment