From f3c82bb8ad752a08a0f21a8481fc516c1ca63107 Mon Sep 17 00:00:00 2001 From: Bill Schnurr Date: Fri, 10 Apr 2020 10:06:28 -0700 Subject: [PATCH] fix for python 3.8 from microsoft store failing to add new venv (#6086) * fix for python 3.8 from microsoft store failing to add new venv new versions of python >= 3.8 from the windows store have a different executable name (ie. python3.8.exe) in the registry InstallPath, compared to what is in the venv folder (python.exe) so search for both if interpExe is not found. Fix #6082 * minor refactor --- .../PythonTools/PythonTools/Environments/VirtualEnv.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Python/Product/PythonTools/PythonTools/Environments/VirtualEnv.cs b/Python/Product/PythonTools/PythonTools/Environments/VirtualEnv.cs index 5e736004a2..01d52ab65d 100644 --- a/Python/Product/PythonTools/PythonTools/Environments/VirtualEnv.cs +++ b/Python/Product/PythonTools/PythonTools/Environments/VirtualEnv.cs @@ -405,8 +405,11 @@ IInterpreterRegistryService service interpExe = Path.GetFileName(baseInterpreter.Configuration.InterpreterPath); winterpExe = Path.GetFileName(baseInterpreter.Configuration.GetWindowsInterpreterPath()); var scripts = new[] { "Scripts", "bin" }; - interpExe = PathUtils.FindFile(prefixPath, interpExe, firstCheck: scripts); - winterpExe = PathUtils.FindFile(prefixPath, winterpExe, firstCheck: scripts); + + // new versions of python >= 3.8 from the windows store have a different executable name (ie. python3.8.exe) in the + // registry InstallPath, compared to what is in the venv folder (python.exe) so search for both if interpExe is not found. + interpExe = PathUtils.FindFile(prefixPath, interpExe, firstCheck: scripts) ?? PathUtils.FindFile(prefixPath, "python.exe", firstCheck: scripts); + winterpExe = PathUtils.FindFile(prefixPath, winterpExe, firstCheck: scripts) ?? PathUtils.FindFile(prefixPath, "pythonw.exe", firstCheck: scripts); pathVar = baseInterpreter.Configuration.PathEnvironmentVariable; }