Use the interpreter environment if the executable is not available, fixes #1531

This commit is contained in:
Dave Halter
2020-04-02 20:59:35 +02:00
parent 61e9371849
commit 0f2a7215bb

View File

@@ -254,7 +254,14 @@ def get_cached_default_environment():
@time_cache(seconds=10 * 60) # 10 Minutes
def _get_cached_default_environment():
return get_default_environment()
try:
return get_default_environment()
except InvalidPythonEnvironment:
# It's possible that `sys.executable` is wrong. Typically happens
# when Jedi is used in an executable that embeds Python. For further
# information, have a look at:
# https://github.com/davidhalter/jedi/issues/1531
return InterpreterEnvironment()
def find_virtualenvs(paths=None, **kwargs):