Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import nbformat
- from nbconvert.preprocessors import ExecutePreprocessor
- def run_notebook(input_notebook, output_notebook):
- nb = nbformat.read(open(input_notebook), as_version=nbformat.NO_CONVERT)
- ep = ExecutePreprocessor(timeout=-1, kernel_name='python3')
- # Actual run'
- ep.preprocess(nb, {'metadata': {'path':'.'}})
- # write result...
- nbformat.write(nb, open(output_notebook, mode='wt'))
Add Comment
Please, Sign In to add comment