diff --git a/news/2 Fixes/15725.md b/news/2 Fixes/15725.md new file mode 100644 index 000000000000..82954d02137e --- /dev/null +++ b/news/2 Fixes/15725.md @@ -0,0 +1 @@ +Check if Python executable file exists instead of launching the Python process. diff --git a/src/client/common/configSettings.ts b/src/client/common/configSettings.ts index 7d33724750ce..b6e171dc5bea 100644 --- a/src/client/common/configSettings.ts +++ b/src/client/common/configSettings.ts @@ -1,8 +1,8 @@ 'use strict'; // eslint-disable-next-line camelcase -import * as child_process from 'child_process'; import * as path from 'path'; +import * as fs from 'fs'; import { ConfigurationChangeEvent, ConfigurationTarget, @@ -27,7 +27,6 @@ import { DEFAULT_INTERPRETER_SETTING, isTestExecution } from './constants'; import { DeprecatePythonPath } from './experiments/groups'; import { ExtensionChannels } from './insidersBuild/types'; import { IS_WINDOWS } from './platform/constants'; -import * as internalPython from './process/internal/python'; import { IAnalysisSettings, IAutoCompleteSettings, @@ -766,13 +765,7 @@ function getPythonExecutable(pythonPath: string): string { } function isValidPythonPath(pythonPath: string): boolean { - const [args, parse] = internalPython.isValid(); - try { - const output = child_process.execFileSync(pythonPath, args, { encoding: 'utf8' }); - return parse(output); - } catch (ex) { - return false; - } + return fs.existsSync(pythonPath); } function convertSettingTypeToLogLevel(setting: LoggingLevelSettingType | undefined): LogLevel | 'off' {