From c801e24afcd0b7e7d6637200baf91f371993b40c Mon Sep 17 00:00:00 2001 From: mlangkabel Date: Tue, 12 Feb 2019 14:14:11 +0100 Subject: [PATCH] fix get_system_environment misses if same python version has multiple installs The Environment.__init__ may throw an InvalidPythonEnvironment if the call to _get_subprocess() fails. In this case other registered Python environments of the same Python version may still work and shall also be considered. --- jedi/api/environment.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/jedi/api/environment.py b/jedi/api/environment.py index 9fbdeacf..d5f98c3d 100644 --- a/jedi/api/environment.py +++ b/jedi/api/environment.py @@ -333,7 +333,10 @@ def get_system_environment(version): if os.name == 'nt': for exe in _get_executables_from_windows_registry(version): - return Environment(exe) + try: + return Environment(exe) + except InvalidPythonEnvironment: + pass raise InvalidPythonEnvironment("Cannot find executable python%s." % version)