mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-30 12:11:32 +08:00
use a warning for failure to set file permissions
instead of print
This commit is contained in:
parent
cd7e0a939c
commit
53f809d407
@ -9,8 +9,8 @@ import io
|
||||
import json
|
||||
import os
|
||||
import random
|
||||
import sys
|
||||
import traceback
|
||||
import warnings
|
||||
|
||||
from ipython_genutils.py3compat import cast_bytes, str_to_bytes, cast_unicode
|
||||
from traitlets.config import Config, ConfigFileNotFound, JSONFileConfigLoader
|
||||
@ -133,9 +133,10 @@ def persist_config(config_file=None, mode=0o600):
|
||||
|
||||
try:
|
||||
os.chmod(config_file, mode)
|
||||
except Exception:
|
||||
print("Failed to set permissions on %s:" % config_file, file=sys.stderr)
|
||||
traceback.print_exc(file=sys.stderr)
|
||||
except Exception as e:
|
||||
tb = traceback.format_exc()
|
||||
warnings.warn("Failed to set permissions on %s:\n%s" % (config_file, tb),
|
||||
RuntimeWarning)
|
||||
|
||||
|
||||
def set_password(password=None, config_file=None):
|
||||
|
@ -331,9 +331,11 @@ class NotebookPasswordApp(JupyterApp):
|
||||
and removes the need for token-based authentication.
|
||||
"""
|
||||
|
||||
description = __doc__
|
||||
|
||||
def _config_file_default(self):
|
||||
return os.path.join(self.config_dir, 'jupyter_notebook_config.json')
|
||||
description = __doc__
|
||||
|
||||
def start(self):
|
||||
from .auth.security import set_password
|
||||
set_password(config_file=self.config_file)
|
||||
|
Loading…
Reference in New Issue
Block a user