[IPython-dev] method to call to perform a checkpoint/save in IPython API

Matthias BUSSONNIER bussonniermatthias at gmail.com
Thu Nov 27 02:55:14 EST 2014


Le 26 nov. 2014 à 20:12, Robert Alexander a écrit :

> FYI, a simplified version of what I'm trying to do is:
> from IPython.nbformat import current as nbf
> from IPython.html.services.notebooks import nbmanager as nbm
> 
> nb = nbf.new_notebook()
> nbm.save_notebook()
> which give me the following error when running:
> AttributeError: 'module' object has no attribute 'save_notebook'
> I should also point out that I've configured my IPython notebook server to use a custom
> NotebookApp.notebook_manager_class which, among other methods, implements
> def save_notebook(self, model, name, path=''):
> this method is called by the auto-save functionality of the notebook server. What I'm trying to do is basically call an API that performs at auto-save on the notebook server.





What you are looking for is create_checkpoint I believe. (on master at least, might have moved a bit) 

https://github.com/ipython/ipython/blob/b7c85f43feb2eaae3d9be358a4f8f1dac289e0ff/IPython/html/services/contents/manager.py#L160-L177

But be careful not to mistake call in python with call in javascript, the autosave in in javascritp on probably call save notebook here : 

https://github.com/ipython/ipython/blob/b7c85f43feb2eaae3d9be358a4f8f1dac289e0ff/IPython/html/services/contents/manager.py#L160-L177

Cheers, 
-- 
M



> 
> From: ipython-dev-bounces at scipy.org <ipython-dev-bounces at scipy.org> on behalf of Robert Alexander <roalexan at microsoft.com>
> Sent: Wednesday, November 26, 2014 1:08 PM
> To: ipython-dev at scipy.org
> Subject: [IPython-dev] method to call to perform a checkpoint/save in IPython API
>  
> Hi all. Is there a function that I can call in the IPython API (I'm using 2.3.0) to do a save/checkpoint? In other words, save the current notebook programmatically - using the same "path" as would happen if you used the GUI (File->Save and Checkpoint) to save.
> 
> Thanks, Robert
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20141127/02393171/attachment.html>


More information about the IPython-dev mailing list