def run_notebook(self, nb, f):
        """Runs a loaded notebook file."""

        if PYTHON_MAJOR_VERSION == 3:
            kernel_name = 'python3'
        elif PYTHON_MAJOR_VERSION == 2:
            kernel_name = 'python2'
        else:
            raise Exception('Only Python 2 and 3 are supported')
        ep = ExecutePreprocessor(timeout=600, kernel_name=kernel_name)
        try:
            ep.preprocess(nb, {'metadata': {'path': '.'}})
        except CellExecutionError:
            msg = 'Error executing the notebook "%s".\n\n' % f.name
            msg += 'See notebook "%s" for the traceback.' % f.name
            print(msg)
            raise
        finally:
            nbformat.write(nb, f)
def run_notebook ( self , nb , f ) : if PYTHON_MAJOR_VERSION == 3 : kernel_name = 'python3' elif PYTHON_MAJOR_VERSION == 2 : kernel_name = 'python2' else : raise Exception ( 'Only Python 2 and 3 are supported' ) ep = ExecutePreprocessor ( timeout = 600 , kernel_name = kernel_name ) try : ep . preprocess ( nb , { 'metadata' : { 'path' : '.' } } ) except CellExecutionError : msg = 'Error executing the notebook "%s".\n\n' % f . name msg += 'See notebook "%s" for the traceback.' % f . name print ( msg ) raise finally : nbformat . write ( nb , f )
Runs a loaded notebook file.