Skip to content
This repository was archived by the owner on Dec 8, 2022. It is now read-only.

Convey working directory of notebook #21

Merged
merged 1 commit into from
Feb 5, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions nb2kg/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,10 @@ def start_kernel(self, kernel_id=None, path=None, **kwargs):
self.log.info("Request new kernel at: %s" % self.kernels_endpoint)
kernel_env = {k: v for (k, v) in dict(os.environ).items() if k.startswith('KERNEL_')
or k in os.environ.get('KG_ENV_WHITELIST', '').split(",")}
# Convey the full path to where this notebook file is located.
if path is not None and kernel_env.get('KERNEL_WORKING_DIR') is None:
kernel_env['KERNEL_WORKING_DIR'] = self.cwd_for_path(path)

json_body = json_encode({'name': kernel_name, 'env': kernel_env})

response = yield fetch_kg(self.kernels_endpoint, method='POST', body=json_body)
Expand Down