Ensure jupyter config dir exist

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.
Bibo Hao 7 years ago committed by GitHub
parent 9640e1f943
commit 8d43f50f04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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)
config_file = os.path.join(jupyter_config_dir(), 'jupyter_notebook_config.json')
loader = JSONFileConfigLoader(os.path.basename(config_file), os.path.dirname(config_file))

Loading…
Cancel
Save