Skip to content

Fix possible FileNotFoundError in Jupyter startup script #239

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 13, 2021
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
6 changes: 4 additions & 2 deletions src/graph_notebook/start_notebook.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
import json

HOME_PATH = os.path.expanduser("~")
NOTEBOOK_CFG_PATH = HOME_PATH + '/.jupyter/nbconfig/notebook.json'

NBCONFIG_DIR_TREE = HOME_PATH + '/.jupyter/nbconfig'
CFG_FILE_NAME = 'notebook.json'
NOTEBOOK_CFG_PATH = NBCONFIG_DIR_TREE + '/' + CFG_FILE_NAME

def patch_cm_cypher_config():
cypher_cfg = {
Expand All @@ -19,6 +20,7 @@ def patch_cm_cypher_config():
}

try:
os.makedirs(NBCONFIG_DIR_TREE, exist_ok=True)
with open(NOTEBOOK_CFG_PATH, 'r') as file:
notebook_cfg = json.load(file)
except (json.decoder.JSONDecodeError, FileNotFoundError) as e:
Expand Down