a | b/ipynb/run_notebook.py | ||
---|---|---|---|
1 | #!/usr/bin/env python |
||
2 | |||
3 | import nbformat,fire |
||
4 | from nbconvert.preprocessors import ExecutePreprocessor |
||
5 | |||
6 | def run_notebook(path): |
||
7 | "Executes notebook `path` and shows any exceptions. Useful for testing" |
||
8 | nb = nbformat.read(open(path), as_version=nbformat.NO_CONVERT) |
||
9 | ExecutePreprocessor(timeout=600).preprocess(nb, {}) |
||
10 | print('done') |
||
11 | |||
12 | if __name__ == '__main__': fire.Fire(run_notebook) |
||
13 |