ipython/ipython — Issue #886: Notebook kernel crash when specifying --notebook-dir on commandline
Author: fwerner
Created: 2011-10-17 07:43:40+00:00
State: open

Hi,

I start a notebook server like this:

$ ipython notebook --notebook-dir="/home/fwerner/Documents/Notebooks" --pylab=inline

After loading a notebook in my browser, the kernel dies instantly. This is related to the notebook-dir alias, which you can see from the traceback---here's the full console output:

$ ipython notebook --notebook-dir="/home/fwerner/Documents/Notebooks" --pylab=inline --log-level=DEBUG --debug
[IPythonNotebookApp] Config changed:
[IPythonNotebookApp] {'Application': {'log_level': 10}, 'IPKernelApp': {'pylab': u'inline'}, 'NotebookManager': {'notebook_dir': u'/home/fwerner/Documents/Notebooks'}}
[IPythonNotebookApp] Using existing profile dir: u'/home/fwerner/.config/ipython/profile_default'
[IPythonNotebookApp] Searching path [u'/home/fwerner/Development/ipython', u'/home/fwerner/.config/ipython/profile_default'] for config files
[IPythonNotebookApp] Attempting to load config file: ipython_config.py
[IPythonNotebookApp] Config file ipython_config.py not found
[IPythonNotebookApp] Attempting to load config file: ipython_notebook_config.py
[IPythonNotebookApp] Config file not found, skipping: ipython_notebook_config.py
[IPythonNotebookApp] The port 8888 is already in use, trying another random port.
[IPythonNotebookApp] The IPython Notebook is running at: http://127.0.0.1:8904
WARNING:root:404 GET /static/mathjax/MathJax.js?config=TeX-AMS_HTML (127.0.0.1) 0.44ms
[IPythonNotebookApp] Kernel started: e493215c-54f4-49a9-b8a9-a158ea272965
[IPythonNotebookApp] Connecting to: tcp://127.0.0.1:48262
[IPythonNotebookApp] Connecting to: tcp://127.0.0.1:49537
[IPythonNotebookApp] Connecting to: tcp://127.0.0.1:37896
WARNING: Unrecognized alias: 'notebook-dir', it will probably have no effect.Traceback (most recent call last):
File "", line 1, in
File "IPython/zmq/ipkernel.py", line 777, in main
app.initialize()
File "IPython/zmq/ipkernel.py", line 710, in initialize
super(IPKernelApp, self).initialize(argv)
File "IPython/zmq/kernelapp.py", line 279, in initialize
super(KernelApp, self).initialize(argv)
File "IPython/core/application.py", line 306, in initialize
self.parse_command_line(argv)
File "IPython/config/application.py", line 406, in parse_command_line
config = loader.load_config()
File "IPython/config/loader.py", line 575, in load_config
self._convert_to_config()
File "IPython/config/loader.py", line 664, in _convert_to_config
sub_parser.load_config(self.extra_args)
File "IPython/config/loader.py", line 496, in load_config
self._exec_config_str(lhs, rhs)
File "IPython/config/loader.py", line 347, in _exec_config_str
exec exec_str in locals(), globals()
File "", line 1
SyntaxError: can't assign to operator

The SyntaxError is thrown by the (assembled) statement

self.config.notebook-dir=u'/home/fwerner/Documents/Notebooks'

It seems to me that IPython shouldn't even try to run statements like this---or at least catch the SyntaxError and warn the user. But I think the real issue is that the notebook-dir alias isn't known at this point. Maybe it also doesn't have to be known, and the commandline argument should have been swallowed at an earlier stage?

Unfortunately, I'm not familiar enough with the codebase to proceed further.

Cheers,
Felix