takluyver / nbopen

Open a Jupyter notebook in the best available server
BSD 3-Clause "New" or "Revised" License
304 stars 58 forks source link

KeyError in Python 3.4 under IPython 3 dev #9

Closed fonnesbeck closed 9 years ago

fonnesbeck commented 9 years ago

nbopen fails with a KeyError under the current IPython master and Python 3.4:

$ nbopen Sao\ Paulo\ Measles.ipynb 
Traceback (most recent call last):
  File "/usr/local/bin/nbopen", line 3, in <module>
    main()
  File "/usr/local/lib/python3.4/site-packages/nbopen.py", line 49, in main
    nbopen(args.filename, args.profile)
  File "/usr/local/lib/python3.4/site-packages/nbopen.py", line 26, in nbopen
    server_inf = find_best_server(filename, profile)
  File "/usr/local/lib/python3.4/site-packages/nbopen.py", line 14, in find_best_server
    servers = [si for si in notebookapp.list_running_servers(profile=profile) \
  File "/usr/local/lib/python3.4/site-packages/nbopen.py", line 14, in <listcomp>
    servers = [si for si in notebookapp.list_running_servers(profile=profile) \
  File "/usr/local/lib/python3.4/site-packages/IPython/html/notebookapp.py", line 981, in list_running_servers
    if check_pid(info['pid']):
KeyError: 'pid'

Running on OS X 10.10.

takluyver commented 9 years ago

I've run into that too - there's a leftover server info file from IPython 2.x, when we didn't write the pid as a key in the file. I'll do something in IPython to ignore those. In the meantime, you can work around it by deleting ~/.ipython/profile_default/security/nbserver-*.json.

takluyver commented 9 years ago

ipython/ipython#7123 should fix this.