hamogu
hamogu

Reputation: 688

IPython Notebook: Save the currently running notebook as ipynb file using a python command in a cell?

Is there are a way to save the Ipython notebook as an ipynb file from a cell within that notebook?

I know I can save it at any time by manually pressing "CTRL-M S", but I would like to use a command in a cell to do so (python command or %magic). In this way I could "Run all cells" and be sure that the output (e.g. inline figures) is saved into the notebookfile when the execution is finished.

Update: Current versions of the Jupyter notebook (the successor of the IPython notebook) autosave into a hidden folder every few minutes (This feature was in development when I asked the question - see accepted answer).

Upvotes: 1

Views: 1698

Answers (1)

Matt
Matt

Reputation: 27843

No, because the kernel does not know it is accessed from a notebook. Dev version have auto-save feature though, and you could write a javascript extension that listen for cell execution event. But Python is not the way to do it. (or display(Javascript('js-code-to-save-notebook')) in the last cell, but I did not tell you)

Upvotes: 1

Related Questions