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 #5002

Closed
krinsman opened this issue Oct 25, 2019 · 1 comment · Fixed by #5021
Closed

root_dir for Contents Manager not loaded from config file #5002

krinsman opened this issue Oct 25, 2019 · 1 comment · Fixed by #5021

Comments

@krinsman
Copy link
Contributor

krinsman commented Oct 25, 2019

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.

@krinsman
Copy link
Contributor Author

Fixed by #5021

takluyver added a commit that referenced this issue Nov 24, 2019
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 29, 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.

1 participant