Unable to pass tornado_settings command line with a space.
- Dominant language
- Jupyter Notebook
- Stars
- 13.3k
- Forks
- 5.8k
- Avg merge
- 6d 11h
- Merged PRs (30d)
- 7
Description
Trying to do the following:
```docker run -it --rm myDockerimg:latest start-notebook.sh --NotebookApp.base_url=/turing/notebooks/f63e305a-539a-4487-b68d-6a147fafb6ee --NotebookApp.token=2VIKxSkcA8o6mEmaIFvQMSO6z1NQOT+txTjWYqk/dv8= --NotebookApp.notebook_dir=/mnt/arcgis --NotebookApp.tornado_settings="{'headers':{'Content-Security-Policy':'frame-ancestors self *.mydomain.com'}}"```
I need to launch containers where the CSP could change dynamically, hence why I am not using a config file. However, that space in the tornado_settings is causing me a problem. I have tried numerous attemps of single quotes, double quotes, backslashes, etc. to no avail. Can anyone offer any suggestions?
Looking at the Docker logs, I see Jupyter say this:
```
Executing the command: jupyter notebook --NotebookApp.base_url=/turing/notebooks/f63e305a-539a-4487-b68d-6a147fafb6ee --NotebookApp.token=2VIKxSkcA8o6mEmaIFvQMSO6z1NQOT+txTjWYqk/dv8= --NotebookApp.notebook_dir=/mnt/arcgis --NotebookApp.tornado_settings={'headers':{'Content-Security-Policy':'frame-ancestors self'}}
The Jupyter HTML Notebook.
This launches a Tornado based HTML Notebook Server that serves up an
HTML5/Javascript Notebook client.
```
But then complains:
```
[C 15:56:20.505 NotebookApp] Bad config encountered during initialization:
[C 15:56:20.505 NotebookApp] The 'tornado_settings' trait of a NotebookApp instance must be a dict, but a value of class 'str' (i.e. "{'headers':{'Content-Security-Policy':'frame-ancestors") was specified.
```
Contributor guide
Research direction
Start by reproducing the Docker command with the NotebookApp.tornado_settings argument and trace how the notebook command-line entry point parses its value. Done means a spaced tornado_settings value reaches NotebookApp as a dict rather than a truncated string, with the existing initialization validation succeeding.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter-notebook
- Domain
- cli
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100