tkf / emacs-ipython-notebook

IPython notebook client in Emacs
tkf.github.com/emacs-ipython-notebook/
GNU General Public License v3.0
548 stars 51 forks source link

Cannot save notebook in ein #178

Closed nwieder closed 6 years ago

nwieder commented 8 years ago

Hi, whenever I am trying to call ein:notebook-save-notebook (with c-x x-s or directly) I get an error message:

ein: [info] Writing notebook Untiteled.ipynb as nbformat 4.
ein:notebook-save-notebook: Wrong type argument: number-or-marker-p, nil

There is no jupyter console output and I can save the notebooks in the web interface.

Setup:

not sure what's going on, any ideas?

millejoh commented 8 years ago

You can get better information by enabling debugging. Also note that the official repository is now at https://github.com/millejoh/emacs-ipython-notebook. Do the following:

  1. Restart Emacs.
  2. Execute M-x ein:dev-start-debug
  3. Call ein:notebooklist-open
  4. Open/create a notebook, add some stuff, then try to save.
  5. Hopefully a debug backtrace will open up - send me the contents.
  6. You can also take a look at the ein:log-all buffer. When debugging is enabled websocket debugging info gets written to a separate buffer as well, if you can find it and send me the contents that would be swell.
nwieder commented 8 years ago

Thanks for the reply. I attached the debug backtrace!

ein_bug.txt

millejoh commented 8 years ago

Not as helpful as I had hoped. I haven't had problems with saving in some time. Could you send a copy of the notebook you are trying to save, also let me know the command line you use to start jupyter?

nwieder commented 8 years ago

Thanks for getting back on this.

This is how I start jupyter; alias pnb='ipython notebook --ip 127.0.0.1' While I'm writing this I'm realizing that I have been using the ipython command (old .bashrc alias...) instead of the jupyter command. But the error persists either way.

The error appears in every notebook I am using. Find attached an example that I saved through the web interface (just remove the .txt had to add it to append it here).

To be fair, I should mention that I am on debian sid (unstable), even though I don't see how this should affect this matter. The whole issue is not super important to me personally since ein saving on my main working station (OSX 10.11) works flawless.

Keep up the great work, thanks for all the effort!

test.ipynb.txt .

millejoh commented 8 years ago

Certainly nothing out of the ordinary there. At this point, if I could recreate the error, I would be using the Lisp debugger to step through the code as it called ein:content-save, but since I don't have any systems to run Debian Sid on I unfortunately cannot reproduce.

This probably won't help much, but my only suggestion is to double check that you have the latest version of ein and its dependencies downloaded from MELPA. For good measure you can also call ein:byte-compile-ein, but again I don't expect it to do much.

Also, was there anything of note in ein:log-all or the websocket log buffer while you had ein in debug mode?

lukeorland commented 6 years ago

I needed to disable xsrf, per this: https://github.com/nteract/hydrogen/issues/922#issuecomment-315665849

The errors I was seeing from the jupyter notebook server were like this:

[W 11:08:28.874 NotebookApp] 403 PUT /api/contents/notebooks/path/to/notebook.ipynb (127.0.0.1): '_xsrf' argument missing from POST                          
[W 11:08:28.874 NotebookApp] '_xsrf' argument missing from POST

disabling xsrf doesn't concern me too much in this case, since I'm running the server on my localhost and not allowing external connections to it.