jupyter / jupyter-js-notebook

JupyterLab notebook
BSD 3-Clause "New" or "Revised" License
46 stars 18 forks source link

Sample app can't open an empty notebook (without metadata info inside) #101

Closed tediyuwono closed 8 years ago

tediyuwono commented 8 years ago

If I change the content of sample test.ipynb with an emply document as following:

{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 0
}

I got an exception

bundle.js:2413 Exception in signal handler: TypeError: Cannot read property 'display_name' of undefined(…)

from deserialize() in :

contents.get(NOTEBOOK, {}).then(function (data) {
      jupyter_js_notebook_1.deserialize(data.content, nbModel);

I managed to avoid the exception by adding following code before deserialize call:

if (!data.content.metadata.kernelspec) {
data.content.metadata.kernelspec = { "display_name": "", "language": "", "name": ""};
}

but after saving the notebook, the kernel spec information is never updated.

blink1073 commented 8 years ago

Thanks for the report, @tediyuwono! Fix is in #102.