I am trying to write a kernel.json file to support a new kernel that I am developing under Windows 11. It is working fine with hardcoded paths to the executable kernel. How can I use an environment variable to make the template kernel.json file system independent? I have searched the web but not found a tip on how to do this.
For example, my current kernel.json file looks like this, and it works:
{
"argv": ["java",
"-cp",
"C:/Me/MyProject/build/mykernel.jar",
"ca.spatial.jupyter.IBeanshell",
"{connection_file}"],
"display_name": "BeanShell",
"language": "beanshell"
}
I have tried without any success to include an environment variable using (where KERNEL_HOME is the environment variable containing the directory path):
{
"argv": ["java",
"-cp",
"$KERNEL_HOME/mykernel.jar",
"ca.spatial.jupyter.IBeanshell",
"{connection_file}"],
"display_name": "BeanShell",
"language": "beanshell"
}
I also tried
os.path.expandvars('{KERNEL_HOME}/mykernel.jar')
I assume that there is some easy way to do this that I am missing. I am not a pythonista so my apologies if this is a newbie question.