Created
August 5, 2020 01:54
-
-
Save natl/261b5893e40dde1cfd3ef59a0c9e86df to your computer and use it in GitHub Desktop.
Python Notebook Executor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import nbformat | |
| from nbconvert.preprocessors import ExecutePreprocessor | |
| if os.path.exists('./foo.csv'): | |
| os.remove('./foo.csv') | |
| with open('test-notebook.ipynb') as ff: | |
| # This notebook creates foo.csv | |
| nb = nbformat.read(ff, as_version=4) | |
| executor = ExecutePreprocessor(timeout=600, kernel_name='python3') | |
| # This will make foo.csv | |
| out_nb = executor.preprocess(nb) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment