From de7cc8ea53790cdb4fc034e885036924ba61f066 Mon Sep 17 00:00:00 2001 From: rajeshka Date: Wed, 21 Oct 2020 17:36:47 -0700 Subject: [PATCH] Fix: Switching powershell notebooks reset kernel.json and failed to resolve kernel paths. (#13026) * Set python path in kernel specs when running on SAW devices. * Use tab spacer for kernel json. * Update path to jupyter kernelspec. * removing the kernelspec write * Changed powershell kernel.json to use appdata folder * Addressed PR and added try catches around the code. * removed redundant try catch * removed redundant try catch * removed another try catch * removed space * Fix for multiple powershell notebook failing issue Co-authored-by: Cory Rivera --- extensions/notebook/src/jupyter/jupyterServerInstallation.ts | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/extensions/notebook/src/jupyter/jupyterServerInstallation.ts b/extensions/notebook/src/jupyter/jupyterServerInstallation.ts index be51a1fc1a..2d42e8acfc 100644 --- a/extensions/notebook/src/jupyter/jupyterServerInstallation.ts +++ b/extensions/notebook/src/jupyter/jupyterServerInstallation.ts @@ -80,8 +80,6 @@ export class JupyterServerInstallation implements IJupyterServerInstallation { private readonly _runningOnSAW: boolean; - private _kernelSpecsUpdated = false; - constructor(extensionPath: string, outputChannel: vscode.OutputChannel) { this.extensionPath = extensionPath; this.outputChannel = outputChannel; @@ -717,7 +715,7 @@ export class JupyterServerInstallation implements IJupyterServerInstallation { } public async updateKernelSpecPaths(kernelsFolder: string): Promise { - if (!this._runningOnSAW || this._kernelSpecsUpdated) { + if (!this._runningOnSAW) { return; } let fileNames = await fs.readdir(kernelsFolder); @@ -726,7 +724,6 @@ export class JupyterServerInstallation implements IJupyterServerInstallation { let folderPaths = filePaths.filter((value, index) => value && fileStats[index].isDirectory()); let kernelFiles = folderPaths.map(folder => path.join(folder, 'kernel.json')); await Promise.all(kernelFiles.map(file => this.updateKernelSpecPath(file))); - this._kernelSpecsUpdated = true; } private async updateKernelSpecPath(kernelPath: string): Promise {