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

root_dir for Contents Manager not loaded from config file #134

Closed
krinsman opened this issue Oct 31, 2019 · 3 comments · Fixed by #135
Closed

root_dir for Contents Manager not loaded from config file #134

krinsman opened this issue Oct 31, 2019 · 3 comments · Fixed by #135
Labels
Milestone

Comments

@krinsman
Copy link
Contributor

I added the lines

c.ContentsManager.root_dir = '~'
c.FileContentsManager.root_dir = '~'

to ~/.jupyter/jupyter_notebook_config.py.

I then ran the Jupyter notebook server in debug mode, as follows (the setting of notebook_dir is deliberate):

jupyter lab --notebook-dir='/' --debug

EDIT: the exact same things happen when using the command

jupyter notebook --notebook-dir='/' --debug

and as far as I can tell, JupyterLab uses Notebook's contents manager anyway /EDIT
and it confirmed that the config file was loaded:

[D 16:50:53.349 LabApp] Loaded config file: ~/.jupyter/jupyter_notebook_config.py

My notebook server extension, which uses the .save method of the contents manager to save a notebook to the user's home directory (well in practice, to the root_dir of the contents manager), reports a 403 permissions error when trying to run, and in its log output (see code on GitHub) shows that the value of the contents manager's root directory is the value of notebook_dir, instead of the value specified in the config file.

[D 16:51:48.310 LabApp] Contents manager root_dir: /

This would be expected if no value of root_dir had been specified in the config file, since according to the code, the value of notebook_dir is to be loaded as the default if no value is specified in the configuration. However, a value was specified, and the value of root_dir is supposed to be configurable, so this seems to be a bug.

For further evidence that the value of root_dir specified in the config file is being ignored, I changed the config file to say

c.FileContentsManager.root_dir = 42

Because the value of root_dir is validated, if this configuration is being loaded, then a TraitError should be thrown as a result of this configuration setting. However, no errors are raised when starting the notebook server.

Random Thoughts:
All I can think of at the moment is that perhaps JupyterLab uses a different contents manager than the Jupyter notebook, maybe a subclass, and that for this reason the configuration is being effectively ignored? But I also changed the value of c.ContentsManager.root_dir in the config file, as well as c.LargeFileContentsManager.root_dir (since as far as I can tell the LargeFileContentsManager subclass of FileContentsManager is actually what's loaded/used), but it still does nothing. I initially thought that this was an issue with JupyterHub, but am now fairly convinced that this is not the case, especially since it's possible to reproduce the problem without running JupyterHub.

Note: I originally posted this issue in the Notebook repository, but this has nothing to do with the Notebook frontend, and is about the server backend used by both Lab and Notebook (and JupyterHub-SingleUser), so it seems like it might fit here. Please let me know if that is in fact mistaken.

@krinsman krinsman mentioned this issue Oct 31, 2019
@krinsman
Copy link
Contributor Author

fixed by #135

@Zsailer
Copy link
Member

Zsailer commented Dec 2, 2019

@krinsman Really sorry for the slow reply here. I see your PR was merged in jupyter/notebook. We're sprinting on jupyter_server (and other Jupyter-related projects) this week, so we should get some time to review this issue closely and merge #135.

Thanks for you patience!

@Zsailer Zsailer added the bug label Dec 2, 2019
@Zsailer Zsailer added this to the 0.2.0 Release milestone Dec 2, 2019
@krinsman
Copy link
Contributor Author

krinsman commented Dec 3, 2019

@Zsailer Thank you for the heads-up/update!

No worries, I needed to update the PR I made to match the PR which was merged into notebook anyway. (It's done now.) Thank you for the reminder!

Zsailer added a commit that referenced this issue Dec 14, 2019
Zsailer added a commit to Zsailer/jupyter_server that referenced this issue Nov 18, 2022
* set default port numbers

* Bump to 0.12.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants