Hi all. This is my first post… I hope it hits the mark.
I have created two notebooks to demonstrate a problem with nbconvert
.
-
ConvertMePython.ipynb
uses a python kernel and contains the markdown cell:
This notebook is running a python kernel. Next is print("Hello World!")
followed by the code cell
print("Hello World!")
-
ConvertMebash.ipynb
uses a bash kernel and contains the markdown cell:
This notebook is running a bashkernel. Next is printf "Hello World!\n"
followed by the code cell
printf "Hello World!\n"
nbconvert
works perfectly with the first notebook
> jupyter nbconvert --execute --to html ConvertMePython.ipynb
[NbConvertApp] Converting notebook ConvertMePython.ipynb to html
[NbConvertApp] Writing 575045 bytes to ConvertMePython.html
…but fails with the second:
jupyter nbconvert --execute --to html ConvertMeBash.ipynb
[NbConvertApp] Converting notebook ConvertMeBash.ipynb to html
Traceback (most recent call last):
File "/opt/conda/bin/jupyter-nbconvert", line 10, in <module>
sys.exit(main())
File "/opt/conda/lib/python3.9/site-packages/jupyter_core/application.py", line 269, in launch_instance
return super().launch_instance(argv=argv, **kwargs)
#... lines deleted for brevity...
File "/opt/conda/lib/python3.9/site-packages/nbclient/client.py", line 919, in _check_raise_for_error
raise CellExecutionError.from_cell_and_msg(cell, exec_reply_content)
nbclient.exceptions.CellExecutionError: An error occurred while executing the following cell:
------------------
printf 'Hello World!\n'
------------------
: 1
I can get nbconvert
to render the second notebook with the following command line
> jupyter nbconvert --execute --allow-errors --to html ConvertMeBash.ipynb
[NbConvertApp] Converting notebook ConvertMeBash.ipynb to html
[NbConvertApp] Writing 575224 bytes to ConvertMeBash.html
however, the resulting HTML looks like this:
I’ve searched for a similar issue, but to no avail. Can anyone advise how to get nbconvert
to work with a notebook that uses a bash kernel?