[IPython-User] feature request : auto save ipython notebook file
Thu Mar 22 18:09:27 CDT 2012
On Thu, Mar 22, 2012 at 4:05 PM, Fernando Perez <email@example.com> wrote:
> On Thu, Mar 22, 2012 at 3:44 PM, Brian Granger <firstname.lastname@example.org> wrote:
>> We are working on this one.
> But note that what we're discussing is a *background* autosave, that
> would save the notebook with a *different* filename than the real one,
> to be used only in case of a crash. What the OP is asking for is an
> autosave that automatically saves the notebook he is working on
> directly, and that's something I've said multiple times I absolutely
> will not have on by default, because it risks saving a state that may
> be unwanted. Since we have no undo/history capability, this would be
Yes, I missed this distinction and I completely agree with you.
> Fortunately, the OP can have autosave right now, just put this in your
> startup file:
> def autosave(interval=5):
> """Autosave the notebook every interval (in minutes)"""
> interval *= 60*1000 # JS wants intervals in miliseconds
> tpl = 'setInterval ( "IPython.notebook.save_notebook()", %i );'
> and call it anywhere in your notebook to activate it.
Nice, very clever!
> Alternately, just put this (in this case, using 5 minutes):
> setInterval ( "IPython.notebook.save_notebook()", 5*60*1000 );
> in the first cell of your notebook and make it a markdown cell.
> You're done, autosave is on for that notebook everytime you open it.
Not quite a pretty but also does the job.
> Remember: you have full access to the notebook 'application' itself
> with a UI element ourselves, it's likely just a few lines of code away
> for you.
> IPython-User mailing list
Brian E. Granger
Cal Poly State University, San Luis Obispo
email@example.com and firstname.lastname@example.org
More information about the IPython-User