Skip to content

Commit

Permalink
Replace {resource_dir} in kernelspec.argv
Browse files Browse the repository at this point in the history
  • Loading branch information
DonJayamanne committed Feb 3, 2025
1 parent 0c4c134 commit f3581f3
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/kernels/raw/finder/localKernelSpecFinderBase.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,15 @@ export async function loadKernelSpec(
logger.error(`Failed to parse kernelspec ${specPath}`, ex);
return;
}

// Replace the `resource_dir` in the kernelspec argv with the actual path
// Check code in format_kernel_cmd of jupyter_client/manager.py
// The values `{connection_file}`, `{prefix}` and `resource_dir` are replaced with the actual values.
const resourceDir = path.dirname(specPath.fsPath);
kernelJson.argv = kernelJson.argv.map((arg) => {
return arg.replaceAll('{resource_dir}', resourceDir);
});

if (cancelToken.isCancellationRequested) {
return;
}
Expand Down

0 comments on commit f3581f3

Please sign in to comment.