Guest User

Untitled

a guest
May 21st, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.40 KB | None | 0 0
  1. import nbformat
  2. from nbconvert.preprocessors import ExecutePreprocessor
  3.  
  4.  
  5. def run_notebook(input_notebook, output_notebook):
  6. nb = nbformat.read(open(input_notebook), as_version=nbformat.NO_CONVERT)
  7. ep = ExecutePreprocessor(timeout=-1, kernel_name='python3')
  8. # Actual run'
  9. ep.preprocess(nb, {'metadata': {'path':'.'}})
  10. # write result...
  11. nbformat.write(nb, open(output_notebook, mode='wt'))
Add Comment
Please, Sign In to add comment