Skip to content

Commit 672d07e

Browse files
author
Kartik Raj
authored
Do not use -I flag in case we're unable to find encodings module when validating python (#20803)
Closes #20793
1 parent 2442dfb commit 672d07e

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/client/pythonEnvironments/base/info/environmentInfoService.ts

+9-4
Original file line numberDiff line numberDiff line change
@@ -169,11 +169,16 @@ class EnvironmentInfoService implements IEnvironmentInfoService {
169169
return undefined;
170170
});
171171
} else if (reason) {
172-
if (reason.message.includes('Unknown option: -I')) {
172+
if (
173+
reason.message.includes('Unknown option: -I') ||
174+
reason.message.includes("ModuleNotFoundError: No module named 'encodings'")
175+
) {
173176
traceWarn(reason);
174-
traceError(
175-
'Support for Python 2.7 has been dropped by the Python extension so certain features may not work, upgrade to using Python 3.',
176-
);
177+
if (reason.message.includes('Unknown option: -I')) {
178+
traceError(
179+
'Support for Python 2.7 has been dropped by the Python extension so certain features may not work, upgrade to using Python 3.',
180+
);
181+
}
177182
return buildEnvironmentInfo(env, false).catch((err) => {
178183
traceError(err);
179184
return undefined;

0 commit comments

Comments
 (0)