Skip to content

AttributeError on tab completion of pip install -U ... #5751

@hugovk

Description

@hugovk

Environment

  • pip version: 18.0
  • Python version: 3.7.0
  • OS: macOS High Sierra

Using iTerm2 3.1.7 or Terminal.app.

Description

Attempt pip install -U projectname with tab completion.

Expected behavior

Tab completion works, or at least no error.

How to Reproduce

  1. Type pip install -U or pip install --upgrade then a few letters of a project name (eg. just p below), then press the tab key.
  2. An error occurs:

Output

$ pip install --upgrade pTraceback (most recent call last):
  File "/usr/local/bin/pip3", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/__init__.py", line 293, in main
    autocomplete()
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/__init__.py", line 121, in autocomplete
    cwords, cword, subcommand.parser.option_list_all,
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/__init__.py", line 170, in get_path_completion_type
    for x in opt.metavar.split('/')):
AttributeError: 'NoneType' object has no attribute 'split'

Notes

  • When omitting -U or --upgrade, pressing tab doesn't complete anything but more importantly there's no error.

  • No error with pip 18.0 on Python 2.7.15. Pressing tab suggests files/directories in current dir (with and without -U).

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: autocompleteAutocompletion in shells (pip completion)auto-lockedOutdated issues that have been locked by automationkind: crashFor situations where pip crashes

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions