0

I am trying to autorun the notebook on launch.

I found this code (https://newbedev.com/jupyter-notebook-run-all-cells-on-open same here Jupyter notebook run all cells on open)

%%html
<script>
    // AUTORUN ALL CELLS ON NOTEBOOK-LOAD!
    require(
        ['base/js/namespace', 'jquery'], 
        function(jupyter, $) {
            $(jupyter.events).on("kernel_ready.Kernel", function () {
                console.log("Auto-running all cells-below...");
                jupyter.actions.call('jupyter-notebook:run-all-cells-below');
                jupyter.actions.call('jupyter-notebook:save-notebook');
                
            });
        }
    );
</script>

It works fine, but from time to time when I open the notebook it won´t run automatically the cells. I have been trying to tweek it somehow but it didn´t worked. Does any of you know what causes this or any way of fixing it?

I´ve also tried to use contrib_nbextensions init_cell (https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/nbextensions/init_cell/README.html) but it seems to be outdated.

Any help would be appreciated. Thanks in advance.

0 Answers0