@@ -209,9 +209,9 @@ export class JupyterExecution implements IJupyterExecution, Disposable {
209209 kernelSpec = await this . getMatchingKernelSpec ( connection , cancelToken ) ;
210210 }
211211
212- // If still not found, throw an error
212+ // If still not found, log an error (this seems possible for some people, so use the default)
213213 if ( ! kernelSpec ) {
214- throw new Error ( localize . DataScience . jupyterKernelSpecNotFound ( ) ) ;
214+ this . logger . logError ( localize . DataScience . jupyterKernelSpecNotFound ( ) ) ;
215215 }
216216
217217 // Try to connect to our jupyter process
@@ -254,7 +254,7 @@ export class JupyterExecution implements IJupyterExecution, Disposable {
254254 return result . stdout ;
255255 }
256256
257- private async getMatchingKernelSpec ( connection ?: IConnection , cancelToken ?: CancellationToken ) : Promise < IJupyterKernelSpec | undefined > {
257+ protected async getMatchingKernelSpec ( connection ?: IConnection , cancelToken ?: CancellationToken ) : Promise < IJupyterKernelSpec | undefined > {
258258 // If not using an active connection, check on disk
259259 if ( ! connection ) {
260260 // Get our best interpreter. We want its python path
@@ -681,18 +681,23 @@ export class JupyterExecution implements IJupyterExecution, Disposable {
681681 const kernelSpecCommand = await this . findBestCommand ( KernelSpecCommand ) ;
682682
683683 if ( kernelSpecCommand ) {
684- // Ask for our current list.
685- const list = await kernelSpecCommand . exec ( [ 'list' ] , { throwOnStdErr : true , encoding : 'utf8' } ) ;
686-
687- // This should give us back a key value pair we can parse
688- const lines = list . stdout . splitLines ( { trim : false , removeEmptyEntries : true } ) ;
689-
690- // Generate all of the promises at once
691- const promises = lines . map ( l => this . readSpec ( l ) ) ;
692-
693- // Then let them run concurrently (they are file io)
694- const specs = await Promise . all ( promises ) ;
695- return specs . filter ( s => s ) ;
684+ try {
685+ // Ask for our current list.
686+ const list = await kernelSpecCommand . exec ( [ 'list' ] , { throwOnStdErr : true , encoding : 'utf8' } ) ;
687+
688+ // This should give us back a key value pair we can parse
689+ const lines = list . stdout . splitLines ( { trim : false , removeEmptyEntries : true } ) ;
690+
691+ // Generate all of the promises at once
692+ const promises = lines . map ( l => this . readSpec ( l ) ) ;
693+
694+ // Then let them run concurrently (they are file io)
695+ const specs = await Promise . all ( promises ) ;
696+ return specs . filter ( s => s ) ;
697+ } catch {
698+ // This is failing for some folks. In that case return nothing
699+ return [ ] ;
700+ }
696701 }
697702 }
698703
0 commit comments