-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Closed
Labels
Milestone
Description
Description
The introduction of a redirect file in 270c0f9 breaks usage of jupyter notebook list, as the logic for determining running notebook servers relies on iterating over all files in runtime-dir with prefix "nbserver-" and trying to load as JSON.
See:
notebook/notebook/notebookapp.py
Line 1842 in 51dae23
| if file_name.startswith('nbserver-'): |
Reproduction
jupyter notebookjupyter notebook list
Error:
File "<env>/python3.6/site-packages/notebook/notebookapp.py", line 1836, in list_running_servers
info = json.load(f)
File "<env>/lib/python3.6/json/__init__.py", line 299, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "<env>/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "<env>/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "<env>/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)
Change
The use of the redirect file (format nbserver-%s-open.html) breaks this assumption and causes a JSON parsing error (trying to parse an HTML file as JSON).
How to fix
Two possibilities for resolving:
- Use different prefix for redirect file
- Update notebook list behaviour to filter for files matching format
nbserver-\d+.json
dickmao