Skip to content
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

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

Closed
ChrisHowlin opened this issue Dec 16, 2018 · 6 comments · Fixed by #4284
Closed

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

ChrisHowlin opened this issue Dec 16, 2018 · 6 comments · Fixed by #4284

Comments

@ChrisHowlin
Copy link

ChrisHowlin commented Dec 16, 2018

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
@ChrisHowlin
Copy link
Author

Tagging @takluyver as original committer of 270c0f9

@ChrisHowlin
Copy link
Author

Introduced in 5.7.3

@takluyver
Copy link
Member

Gah, sorry. I didn't think to check that, and our test suite wasn't sufficient to pick it up. #4284 should fix it, and add the missing test. Can you give that a try and check that there aren't any other problems affecting your use cases? Hopefully I can do a 5.7.4 soon.

@ChrisHowlin
Copy link
Author

No worries, I was able to revert to 5.7.2 which works fine. I'll test against the fix now and confirm it works OK.

@ChrisHowlin
Copy link
Author

Looks good to me. I've checked out the fix and jupyter notebook list works as expected.

@takluyver
Copy link
Member

Thanks! I'm going to bed soon, so 5.7.4 will probably be tomorrow.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants