@@ -18,7 +18,7 @@ import {
18
18
} from '../../locator' ;
19
19
import { PythonEnvsChangedEvent } from '../../watcher' ;
20
20
import { resolveBasicEnv } from './resolverUtils' ;
21
- import { traceVerbose } from '../../../../logging' ;
21
+ import { traceVerbose , traceWarn } from '../../../../logging' ;
22
22
import { getEnvironmentDirFromPath , getInterpreterPathFromDir , isPythonExecutable } from '../../../common/commonUtils' ;
23
23
import { getEmptyVersion } from '../../info/pythonVersion' ;
24
24
@@ -167,7 +167,14 @@ function getResolvedEnv(interpreterInfo: InterpreterInformation, environment: Py
167
167
async function getExecutablePathAndEnvPath ( path : string ) {
168
168
let executablePath : string ;
169
169
let envPath : string ;
170
- const isPathAnExecutable = await isPythonExecutable ( path ) ;
170
+ const isPathAnExecutable = await isPythonExecutable ( path ) . catch ( ( ex ) => {
171
+ traceWarn ( 'Failed to check if' , path , 'is an executable' , ex ) ;
172
+ // This could happen if the path doesn't exist on a file system, but
173
+ // it still maybe the case that it's a valid file when run using a
174
+ // shell, as shells may resolve the file extensions before running it,
175
+ // so assume it to be an executable.
176
+ return true ;
177
+ } ) ;
171
178
if ( isPathAnExecutable ) {
172
179
executablePath = path ;
173
180
envPath = getEnvironmentDirFromPath ( executablePath ) ;
0 commit comments