-
Notifications
You must be signed in to change notification settings - Fork 586
Closed
Description
Description
If there are cells with cell type raw
in notebooks, the following expection is thrown:
" File \"/usr/local/lib/python3.9/site-packages/nbconvert/exporters/html.py\", line 223, in from_notebook_node\n return super().from_notebook_node(nb, resources, **kw)\n", " File \"/usr/local/lib/python3.9/site-packages/nbconvert/exporters/templateexporter.py\", line 402, in from_notebook_node\n output = self.template.render(nb=nb_copy, resources=resources)\n",
" File \"/usr/local/lib/python3.9/site-packages/jinja2/environment.py\", line 1304, in render\n self.environment.handle_exception()\n",
" File \"/usr/local/lib/python3.9/site-packages/jinja2/environment.py\", line 925, in handle_exception\n raise rewrite_traceback_stack(source=source)\n",
" File \"/usr/local/share/jupyter/nbconvert/templates/custom/index.html.j2\", line 1, in top-level template code\n {%- extends 'lab/index.html.j2' -%}\n",
" File \"/usr/local/share/jupyter/nbconvert/templates/lab/index.html.j2\", line 3, in top-level template code\n {% from 'jupyter_widgets.html.j2' import jupyter_widgets %}\n",
" File \"/usr/local/share/jupyter/nbconvert/templates/lab/base.html.j2\", line 2, in top-level template code\n {% from 'celltags.j2' import celltags %}\n",
" File \"/usr/local/share/jupyter/nbconvert/templates/base/display_priority.j2\", line 1, in top-level template code\n {%- extends 'base/null.j2' -%}\n",
" File \"/usr/local/share/jupyter/nbconvert/templates/base/null.j2\", line 26, in top-level template code\n {%- block body -%}\n", " File \"/usr/local/share/jupyter/nbconvert/templates/custom/index.html.j2\", line 141, in block 'body'\n {{ super() }}\n",
" File \"/usr/local/share/jupyter/nbconvert/templates/base/null.j2\", line 29, in block 'body'\n {%- block body_loop -%}\n",
" File \"/usr/local/share/jupyter/nbconvert/templates/base/null.j2\", line 31, in block 'body_loop'\n {%- block any_cell scoped -%}\n",
" File \"/usr/local/share/jupyter/nbconvert/templates/base/null.j2\", line 91, in block 'any_cell'\n {%- block rawcell scoped -%}\n",
" File \"/usr/local/share/jupyter/nbconvert/templates/lab/base.html.j2\", line 119, in block 'rawcell'\n {{ cell.source | clean_html }}\n",
" File \"src/lxml/html/clean.py\", line 562, in lxml.html.clean.Cleaner.clean_html\n",
" File \"/usr/local/lib64/python3.9/site-packages/lxml/html/__init__.py\", line 873, in fromstring\n doc = document_fromstring(html, parser=parser, base_url=base_url, **kw)\n",
" File \"/usr/local/lib64/python3.9/site-packages/lxml/html/__init__.py\", line 761, in document_fromstring\n raise etree.ParserError(\n", "lxml.etree.ParserError: Document is empty\n"]
Looking into the nbconvert code, I found out that the clean_html
, which seems to cause the problem, was already replaced
in this PR: #1854
Testing the problematic notebook with the nbconvert main branch (7.1.0.dev0), I found that the problem was resolved. Are there plans to release this soon?
To reproduce:
Insert a raw cell in any notebook.
Sample notebook
raw_cell.ipynb.txt
Nbconvert version: 7.0.0
Metadata
Metadata
Assignees
Labels
No labels