Skip to content

Commit

Permalink
added check_kernel_spec() ; https://jupyter-client.readthedocs.io/en/…
Browse files Browse the repository at this point in the history
…latest/api/kernelspec.html;

--ExecutePreprocessor.kernel_name to python # ijstokes et al, Command line execution of a jupyter notebook fails in default Anaconda 4.1, anaconda/nb_conda_kernels#34
  • Loading branch information
kangwonlee committed Oct 21, 2017
1 parent 2c4720f commit 3f8a4fe
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion test_nb.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,21 @@
import tempfile


def check_kernel_spec():
# https://jupyter-client.readthedocs.io/en/latest/api/kernelspec.html
import jupyter_client.kernelspec as jk
kernel_spec_manager = jk.KernelSpecManager()

print(kernel_spec_manager.get_all_specs())


def _exec_notebook(path):
# http://nbconvert.readthedocs.io/en/latest/execute_api.html
# ijstokes et al, Command line execution of a jupyter notebook fails in default Anaconda 4.1, https://github.com/Anaconda-Platform/nb_conda_kernels/issues/34
with tempfile.NamedTemporaryFile(suffix=".ipynb") as fout:
args = ["jupyter", "nbconvert", "--to", "notebook", "--execute",
"--ExecutePreprocessor.timeout=1000",
"--ExecutePreprocessor.kernel_name=python3",
"--ExecutePreprocessor.kernel_name=python",
"--output", fout.name, path]
subprocess.check_call(args)

Expand Down

0 comments on commit 3f8a4fe

Please sign in to comment.