Change Default autosave Interval in IPython Notebook

The default autosave interval in IPython notebook is 120 seconds. You can change this using the %autosave magic command for an individual notebook like this:

IPython Notebook autosave

But if you want to change it for all your notebooks, you need to modify the custom.js file.

  1. Navigate to your jupyter config directory, which you can find by typing the following at the command line:
    jupyter --config-dir
  2. From there, open the custom folder. My complete path is C:\Users\Nat\.jupyter\custom
  3. In that folder, you should find a custom.js file. If there isn’t one, you should be able to create one. Open it in a text editor and add this code:
    define([
        'base/js/namespace',
        'base/js/events'
        ],
        function(IPython, events) {
            events.on("notebook_loaded.Notebook",
            	function () {
      				IPython.notebook.set_autosave_interval(180000); //in milliseconds
    			}
      		);
            //may include additional events.on() statements
        }
    );
  4. Save the file.

Related Training: Advanced Python

About Webucator

Webucator provides instructor-led training to students throughout the US and Canada. We have trained over 90,000 students from over 16,000 organizations on technologies such as Microsoft ASP.NET, Microsoft Office, Azure, Windows, Java, Adobe, Python, SQL, JavaScript, Angular and much more. Check out our complete course catalog.