@@ -27,23 +27,27 @@ export class PosixKnownPathsLocator extends Locator<BasicEnvInfo> {
27
27
28
28
const iterator = async function * ( kind : PythonEnvKind ) {
29
29
traceVerbose ( 'Searching for interpreters in posix paths locator' ) ;
30
- // Filter out pyenv shims. They are not actual python binaries, they are used to launch
31
- // the binaries specified in .python-version file in the cwd. We should not be reporting
32
- // those binaries as environments.
33
- const knownDirs = ( await commonPosixBinPaths ( ) ) . filter ( ( dirname ) => ! isPyenvShimDir ( dirname ) ) ;
34
- let pythonBinaries = await getPythonBinFromPosixPaths ( knownDirs ) ;
30
+ try {
31
+ // Filter out pyenv shims. They are not actual python binaries, they are used to launch
32
+ // the binaries specified in .python-version file in the cwd. We should not be reporting
33
+ // those binaries as environments.
34
+ const knownDirs = ( await commonPosixBinPaths ( ) ) . filter ( ( dirname ) => ! isPyenvShimDir ( dirname ) ) ;
35
+ let pythonBinaries = await getPythonBinFromPosixPaths ( knownDirs ) ;
35
36
36
- // Filter out MacOS system installs of Python 2 if necessary.
37
- if ( isMacPython2Deprecated ) {
38
- pythonBinaries = pythonBinaries . filter ( ( binary ) => ! isMacDefaultPythonPath ( binary ) ) ;
39
- }
37
+ // Filter out MacOS system installs of Python 2 if necessary.
38
+ if ( isMacPython2Deprecated ) {
39
+ pythonBinaries = pythonBinaries . filter ( ( binary ) => ! isMacDefaultPythonPath ( binary ) ) ;
40
+ }
40
41
41
- for ( const bin of pythonBinaries ) {
42
- try {
43
- yield { executablePath : bin , kind, source : [ PythonEnvSource . PathEnvVar ] } ;
44
- } catch ( ex ) {
45
- traceError ( `Failed to process environment: ${ bin } ` , ex ) ;
42
+ for ( const bin of pythonBinaries ) {
43
+ try {
44
+ yield { executablePath : bin , kind, source : [ PythonEnvSource . PathEnvVar ] } ;
45
+ } catch ( ex ) {
46
+ traceError ( `Failed to process environment: ${ bin } ` , ex ) ;
47
+ }
46
48
}
49
+ } catch ( ex ) {
50
+ traceError ( 'Failed to process posix paths' , ex ) ;
47
51
}
48
52
traceVerbose ( 'Finished searching for interpreters in posix paths locator' ) ;
49
53
} ;
0 commit comments