jsvine / nbpreview

Render Jupyter/IPython notebooks without running a notebook server.
https://jsvine.github.io/nbpreview/
MIT License
293 stars 65 forks source link

Nothing happens #1

Closed lexnederbragt closed 9 years ago

lexnederbragt commented 9 years ago

Hi,

When I pick a file, nothing happens. What is supposed to happen?

image

jsvine commented 9 years ago

Oy! That's a problem. Two questions:

(1) Can you send a link to the .ipynb file?

(2) What shows up in your developer console?

Thanks in advance, Jeremy

jsvine commented 9 years ago

Hi @lexnederbragt, just checking on this. The rendered notebook should appear once you pick a file. But it's possible that there's a bug in the nbpreview or notebookjs code. If you send me your .ipynb file, I can try debugging. Thanks!

lexnederbragt commented 9 years ago

I now suspect that it is an issue with IPython3. An older notebook from IPython2 opened nicely, but after converting to the new format reopening failed.

jsvine commented 9 years ago

Seems to be the case! I've added support for IPython3's notebook format to notebook.js and upgraded nbpreview to use the upgraded library. When you get a spare moment, give it a whirl. Working now?

lexnederbragt commented 9 years ago

Seems to be working now, yes!

jorisvandenbossche commented 9 years ago

I have the same issue. I just cloned the repo today, but still a notebook with format 3 renders, but the same converted to format 4 does not render.

In the webconsole I get the error "TypeError: m.language_info is undefined notebook.min.js:1:1163"

jsvine commented 9 years ago

Sorry to hear that, and thanks for flagging. Are you able to share the notebook? (If you'd rather not post it in the issue thread, feel free to email it to me: jsvine@gmail.com.)

jorisvandenbossche commented 9 years ago

it happens even with a simple notebook. An example that fails: https://gist.github.com/jorisvandenbossche/70bc824af4542b891942

jsvine commented 9 years ago

Thanks, @jorisvandenbossche. Looks like I wasn't properly accounting for the differences in how converted vs. non-converted notebooks represent text (a string vs an arrays of strings). I've pushed a commit — https://github.com/jsvine/nbpreview/commit/bc257ed26d66d145283b868402cc0014f40771f5 — that should fix this. Let me know, though, if that fails.

jorisvandenbossche commented 9 years ago

Sorry for that late answer, but that indeed fixed it!

Only, now I have another issue: all lines apart from the first (in code cells) are starting with a ,. Eg a code cell looks like this:

fig, ax = plt.subplots()
,ax.hist(data['speed'][data['speed'].notnull()].values, 50)
,ax.set_xlabel('Speed')
jsvine commented 9 years ago

Odd! This doesn't seem to be happening with the previous notebook you shared. Could you share another that exhibits this problem?

jsvine commented 9 years ago

Hi @jorisvandenbossche, I think I've been able to replicate the problem you were running into, and to fix it. I've just pushed the fixes to master and gh-pages. Give it a whirl: https://jsvine.github.io/nbpreview/

Does that improve things?

jorisvandenbossche commented 9 years ago

That indeed solves it!