diff --git a/news/2983.bugfix.rst b/news/2983.bugfix.rst new file mode 100644 index 0000000000..acfe378072 --- /dev/null +++ b/news/2983.bugfix.rst @@ -0,0 +1 @@ +Pipenv will no longer fail when encountering python versions on Windows that were unintalled. diff --git a/pipenv/vendor/pythonfinder/__init__.py b/pipenv/vendor/pythonfinder/__init__.py index 60192826d3..dbc0026b43 100644 --- a/pipenv/vendor/pythonfinder/__init__.py +++ b/pipenv/vendor/pythonfinder/__init__.py @@ -1,6 +1,6 @@ from __future__ import print_function, absolute_import -__version__ = '1.1.6' +__version__ = '1.1.7.dev0' # Add NullHandler to "pythonfinder" logger, because Python2's default root # logger has no handler and warnings like this would be reported: diff --git a/pipenv/vendor/pythonfinder/cli.py b/pipenv/vendor/pythonfinder/cli.py index 6e7980fede..221cb2fda3 100644 --- a/pipenv/vendor/pythonfinder/cli.py +++ b/pipenv/vendor/pythonfinder/cli.py @@ -56,7 +56,20 @@ def cli(ctx, find=False, which=False, findall=False, version=False, ignore_unsup click.secho("Searching for python: {0!s}".format(find.strip()), fg="yellow") found = finder.find_python_version(find.strip()) if found: + py = found.py_version + comes_from = getattr(py, "comes_from", None) + if comes_from is not None: + comes_from_path = getattr(comes_from, "path", found.path) + else: + comes_from_path = found.path + arch = getattr(py, "architecture", None) click.secho("Found python at the following locations:", fg="green") + click.secho( + "{py.name!s}: {py.version!s} ({py.architecture!s}) @ {comes_from!s}".format( + py=py, comes_from=comes_from_path + ), + fg="yellow", + ) sys.exit(0) else: click.secho("Failed to find matching executable...", fg="yellow") diff --git a/pipenv/vendor/pythonfinder/models/windows.py b/pipenv/vendor/pythonfinder/models/windows.py index e47bcc2c0b..f985630fb3 100644 --- a/pipenv/vendor/pythonfinder/models/windows.py +++ b/pipenv/vendor/pythonfinder/models/windows.py @@ -84,7 +84,10 @@ def get_versions(self): install_path = getattr(version_object.info, "install_path", None) if install_path is None: continue - path = ensure_path(install_path.__getattr__("")) + try: + path = ensure_path(install_path.__getattr__("")) + except AttributeError: + continue try: py_version = PythonVersion.from_windows_launcher(version_object) except InvalidPythonVersion: