aaren / notedown

Markdown <=> IPython Notebook
BSD 2-Clause "Simplified" License
855 stars 115 forks source link

Error while saving file: foo.md display_priority.j2 #92

Open lucasdavid opened 3 years ago

lucasdavid commented 3 years ago

Hello. Firstly, thank you so much for this extension. It really is awesome!

We have used it for quite some days/months with the jupyter/pyspark-notebook docker image. We noticed it started to raise an error when we tried to save the .md notebooks inside jupyter:

screenshot

Stacktrace:

foo_bar_1  | [E 14:38:26.584 NotebookApp] Error while saving file: foo.md display_priority.j2
foo_bar_1  |     Traceback (most recent call last):
foo_bar_1  |       File "/opt/conda/lib/python3.8/site-packages/notebook/services/contents/filemanager.py", line 476, in save
foo_bar_1  |         self._save_notebook(os_path, nb)
foo_bar_1  |       File "/opt/conda/lib/python3.8/site-packages/notedown/contentsmanager.py", line 59, in _save_notebook
foo_bar_1  |         markdown = convert(nbjson,
foo_bar_1  |       File "/opt/conda/lib/python3.8/site-packages/notedown/main.py", line 104, in convert
foo_bar_1  |         return writer.writes(notebook)
foo_bar_1  |       File "/opt/conda/lib/python3.8/site-packages/notedown/notedown.py", line 434, in writes
foo_bar_1  |         body, resources = self.exporter.from_notebook_node(notebook)
foo_bar_1  |       File "/opt/conda/lib/python3.8/site-packages/nbconvert/exporters/templateexporter.py", line 384, in from_notebook_node
foo_bar_1  |         output = self.template.render(nb=nb_copy, resources=resources)
foo_bar_1  |       File "/opt/conda/lib/python3.8/site-packages/jinja2/environment.py", line 1090, in render
foo_bar_1  |         self.environment.handle_exception()
foo_bar_1  |       File "/opt/conda/lib/python3.8/site-packages/jinja2/environment.py", line 832, in handle_exception
foo_bar_1  |         reraise(*rewrite_traceback_stack(source=source))
foo_bar_1  |       File "/opt/conda/lib/python3.8/site-packages/jinja2/_compat.py", line 28, in reraise
foo_bar_1  |         raise value.with_traceback(tb)
foo_bar_1  |       File "/opt/conda/lib/python3.8/site-packages/notedown/templates/markdown.tpl", line 1, in top-level template code
foo_bar_1  |         {% extends 'display_priority.tpl' %}
foo_bar_1  |       File "/opt/conda/share/jupyter/nbconvert/templates/compatibility/display_priority.tpl", line 2, in top-level template code
foo_bar_1  |         {%- extends 'display_priority.j2' -%}
foo_bar_1  |     jinja2.exceptions.TemplateNotFound: display_priority.j2
foo_bar_1  | [W 14:38:26.585 NotebookApp] 500 PUT /api/contents/foo.md (172.22.0.1): Unexpected error while saving file: foo.md display_priority.j2
foo_bar_1  | [W 14:38:26.585 NotebookApp] Unexpected error while saving file: foo.md display_priority.j2

Setup

Dockerfile

FROM jupyter/pyspark-notebook

RUN python -m pip install --upgrade --force-reinstall --ignore-installed pip
ADD requirements.txt .
RUN pip install --quiet -r requirements.txt

RUN echo 'c.NotebookApp.contents_manager_class = "notedown.NotedownContentsManager"' >> ~/.jupyter/jupyter_notebook_config.py

Dependencies

Jinja2                        2.11.2
...
jupyter-client                6.1.7
jupyter-core                  4.6.3
jupyter-telemetry             0.0.5
jupyterhub                    1.1.0
jupyterlab                    2.2.8
jupyterlab-pygments           0.1.2
jupyterlab-server             1.2.0
jupyterthemes                 0.20.0
...
notebook                      6.1.4