diff --git a/Python/Product/PythonTools/PythonTools/InterpreterList/InterpreterListToolWindow.cs b/Python/Product/PythonTools/PythonTools/InterpreterList/InterpreterListToolWindow.cs index c250be0d09..0e893ad978 100644 --- a/Python/Product/PythonTools/PythonTools/InterpreterList/InterpreterListToolWindow.cs +++ b/Python/Product/PythonTools/PythonTools/InterpreterList/InterpreterListToolWindow.cs @@ -284,16 +284,18 @@ private void StartInterpreter_Executed(object sender, ExecutedRoutedEventArgs e) factory.Configuration.WindowsInterpreterPath; psi.WorkingDirectory = factory.Configuration.PrefixPath; - var provider = _service.KnownProviders.OfType().FirstOrDefault(); - var vsProject = provider == null ? - null : - provider.GetProject(factory); - var project = vsProject == null ? null : vsProject.GetPythonProject(); - if (project != null) { - psi.EnvironmentVariables[factory.Configuration.PathEnvironmentVariable] = - string.Join(";", project.GetSearchPaths()); - } else { - psi.EnvironmentVariables[factory.Configuration.PathEnvironmentVariable] = string.Empty; + var pathVar = factory.Configuration.PathEnvironmentVariable; + if (!string.IsNullOrEmpty(pathVar)) { + var provider = _service.KnownProviders.OfType().FirstOrDefault(); + var vsProject = provider == null ? + null : + provider.GetProject(factory); + var project = vsProject == null ? null : vsProject.GetPythonProject(); + if (project != null) { + psi.EnvironmentVariables[pathVar] = string.Join(";", project.GetSearchPaths()); + } else { + psi.EnvironmentVariables[pathVar] = string.Empty; + } } Process.Start(psi);