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 <corivera@microsoft.com>
This commit is contained in:
rajeshka
2020-10-21 17:36:47 -07:00
committed by GitHub
parent a427606050
commit de7cc8ea53

View File

@@ -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<void> {
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<void> {