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

Ensure jupyter config dir exist #5078

Merged
merged 2 commits into from
Nov 27, 2019
Merged

Ensure jupyter config dir exist #5078

merged 2 commits into from
Nov 27, 2019

Conversation

haobibo
Copy link
Contributor

@haobibo haobibo commented Nov 24, 2019

The bug: when

  • the user login for the first file with a token and want to change his/her password
  • and if the folder ~/.jupyter (jupyter_config_dir()) does not exist

then the jupyter server will raise a FileNotFoundError exception and return a 500 error.

This change tries to fix this bug by ensuring the folder exists so that the config_file can be opened.

The bug:
When
 - the user login for the first file with a token and want to change his/her password
 - and if the folder `~/.jupyter` (`jupyter_config_dir()`) does not exist
then the jupyter server will raise a `FileNotFoundError` exception and return a 500 error.

This change tries to fix this bug by ensure the folder exist so that the `config_file` can be opened.
@@ -118,6 +118,7 @@ def persist_config(config_file=None, mode=0o600):
"""

if config_file is None:
os.makedirs(jupyter_config_dir(), exist_ok=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be outside the if block, and use os.path.dirname(), so it works the same way if a path is passed in explicitly.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

@takluyver
Copy link
Member

An alpha release of nbconvert has broken notebook's tests, so we're stalled until someone gets to figuring that out and fixing it (I'm not sure yet if it needs changes in the tests or in nbconvert). Other than that, I think this looks good.

@haobibo
Copy link
Contributor Author

haobibo commented Nov 25, 2019

sure, let's wait for that.

@takluyver
Copy link
Member

Close/reopen to rerun tests with master.

@takluyver takluyver closed this Nov 27, 2019
@takluyver takluyver reopened this Nov 27, 2019
@takluyver takluyver merged commit 806904c into jupyter:master Nov 27, 2019
@takluyver
Copy link
Member

Thanks!

@haobibo haobibo deleted the patch-1 branch November 27, 2019 12:16
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants