Skip to content

Creation of redirect fail breaks use of jupyter notebook list #4283

@ChrisHowlin

Description

@ChrisHowlin

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:

if file_name.startswith('nbserver-'):

Reproduction

  1. jupyter notebook
  2. jupyter 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:

  1. Use different prefix for redirect file
  2. Update notebook list behaviour to filter for files matching format nbserver-\d+.json

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions