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

Error when call_subprocess fails with show_stdout=True #3521

Closed
srinchiera opened this Issue Feb 26, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@srinchiera
Contributor

srinchiera commented Feb 26, 2016

If call_subprocess in utils/__init__.py is called with show_stdout=True, and the subprocess fails, pip errors out with UnboundLocalError: local variable 'all_output' referenced before assignment.

To avoid this, it should not try to print all_output when called when show_stdout=True. In this case, the process's stdout will already be printed to the console.

Discovered using this command:

$ pip install git+ssh://git@github.com:uber/vertica-python.git@0.2.1
Collecting git+ssh://git@github.com:uber/vertica-python.git@0.2.1
  Cloning ssh://git@github.com:uber/vertica-python.git (to 0.2.1) to /tmp/pip-8k63_T-build
ssh: Could not resolve hostname github.com:uber: Name or service not known
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.
git clone -q ssh://git@github.com:uber/vertica-python.git /tmp/pip-8k63_T-build
  Complete output from command git clone -q ssh://git@github.com:uber/vertica-python.git /tmp/pip-8k63_T-build:
Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/pip/basecommand.py", line 209, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/site-packages/pip/commands/install.py", line 299, in run
    requirement_set.prepare_files(finder)
  File "/usr/lib/python2.7/site-packages/pip/req/req_set.py", line 359, in prepare_files
    ignore_dependencies=self.ignore_dependencies))
  File "/usr/lib/python2.7/site-packages/pip/req/req_set.py", line 576, in _prepare_file
    session=self.session, hashes=hashes)
  File "/usr/lib/python2.7/site-packages/pip/download.py", line 793, in unpack_url
    unpack_vcs_link(link, location)
  File "/usr/lib/python2.7/site-packages/pip/download.py", line 474, in unpack_vcs_link
    vcs_backend.unpack(location)
  File "/usr/lib/python2.7/site-packages/pip/vcs/__init__.py", line 283, in unpack
    self.obtain(location)
  File "/usr/lib/python2.7/site-packages/pip/vcs/git.py", line 124, in obtain
    self.run_command(['clone', '-q', url, dest])
  File "/usr/lib/python2.7/site-packages/pip/vcs/__init__.py", line 322, in run_command
    spinner)
  File "/usr/lib/python2.7/site-packages/pip/utils/__init__.py", line 712, in call_subprocess
    ''.join(all_output) +
UnboundLocalError: local variable 'all_output' referenced before assignment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment