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

missing notebook path #1362

Open
JoseBlanca opened this issue Apr 1, 2024 · 3 comments
Open

missing notebook path #1362

JoseBlanca opened this issue Apr 1, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@JoseBlanca
Copy link

Description

I have installed the notebook extension, but when I click Help -> "Launch Jupyter Notebook File Browser" what I get is:

URL: http://127.0.0.1:8000/tree
Web response:

Traceback (most recent call last):
  File "/home/jose/devel/pop_lab/.venv/lib/python3.12/site-packages/tornado/web.py", line 1790, in _execute
    result = await result
             ^^^^^^^^^^^^
  File "/home/jose/devel/pop_lab/.venv/lib/python3.12/site-packages/tornado/web.py", line 2688, in get
    self.absolute_path = self.validate_absolute_path(self.root, absolute_path)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jose/devel/pop_lab/.venv/lib/python3.12/site-packages/tornado/web.py", line 2902, in validate_absolute_path
    raise HTTPError(403, "%s is not a file", self.path)
tornado.web.HTTPError: HTTP 403: Forbidden (tree is not a file)

Reproduce

  1. Create the static website with:

$ jupyter lite build --contents src/pop_lab --output-dir output_site

  1. Server the site with:

$ jupyter lite serve --output-dir output_site

  1. Go to: http://127.0.0.1:8000/index.html
  2. Open a notebook in the jupyterlab interface
  3. Click Help -> "Launch Jupyter Notebook File Browser". This tries to open http://127.0.0.1:8000/tree, but fails

However, the url: http://127.0.0.1:8000/tree/ works just fine. So, the last slash is relevant here.

Also, and I don't know if this is part of the same bug or not. The url for a notebook also fails. For example: http://127.0.0.1:8000/notebooks?path=one_locus_two_alleles_simulation.ipynb

Traceback (most recent call last):
  File "/home/jose/devel/pop_lab/.venv/lib/python3.12/site-packages/tornado/web.py", line 1790, in _execute
    result = await result
             ^^^^^^^^^^^^
  File "/home/jose/devel/pop_lab/.venv/lib/python3.12/site-packages/tornado/web.py", line 2688, in get
    self.absolute_path = self.validate_absolute_path(self.root, absolute_path)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jose/devel/pop_lab/.venv/lib/python3.12/site-packages/tornado/web.py", line 2902, in validate_absolute_path
    raise HTTPError(403, "%s is not a file", self.path)
tornado.web.HTTPError: HTTP 403: Forbidden (notebooks is not a file)

The server response is similar:

403 GET /notebooks?path=one_locus_two_alleles_simulation.ipynb (127.0.0.1): notebooks is not a file
403 GET /notebooks?path=one_locus_two_alleles_simulation.ipynb (127.0.0.1) 1.04ms

Context


$ jupyter --version
Selected Jupyter core packages...
IPython          : 8.22.2
ipykernel        : 6.29.3
ipywidgets       : 8.1.2
jupyter_client   : 8.6.1
jupyter_core     : 5.7.2
jupyter_server   : 2.13.0
jupyterlab       : 4.1.5
nbclient         : 0.10.0
nbconvert        : 7.16.3
nbformat         : 5.10.3
notebook         : 7.1.2
qtconsole        : not installed
traitlets        : 5.14.2

$ python --version
Python 3.12.2

$ lsb_release -a
Distributor ID: Ubuntu
Description:    Ubuntu 22.04.4 LTS
Release:        22.04
Codename:       jammy

I have tried in in Firefox 124.0.1 and Chrome 123.0.6312.86.

I hope this report could be useful, If I could help with anything else, I'll be delighted. I'm an experienced Python developer, but, unfortunately I have no Javascript experience.
Best,

Jose Blanca

@JoseBlanca JoseBlanca added the bug Something isn't working label Apr 1, 2024
@jtpio
Copy link
Member

jtpio commented Apr 9, 2024

Thanks @JoseBlanca for the report 👍

It might be something to do with the jupyter lite serve command. Would you be able to check if running python -m http.server --directory output_site might help?

Also linking to #683 which seems to be similar, but was opened when Notebook was still RetroLab.

@JoseBlanca
Copy link
Author

Yes, that works just fine.
The url http://0.0.0.0:8000/tree/ shows a file browser and http://0.0.0.0:8000/tree redirects to http://0.0.0.0:8000/tree/ immediately.

Also, the url http://0.0.0.0:8000/notebooks/?path=one_locus_two_alleles_simulation.ipynb opens the notebook as expected.

Best,

José Blanca

@jtpio
Copy link
Member

jtpio commented Apr 9, 2024

OK thanks for checking.

Maybe this likely requires a fix in the jupyter lite serve command to handle trailing slashes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants