Nbconvert failed: No filter named 'escape_html_script'

hi I am getting this error and I can’t find the problem, I tried uninstalling nbconvert and install but its the same.

jupyter nbconvert account_database.ipynb
Traceback (most recent call last):
File “/Users/jiten/anaconda3/bin/jupyter-nbconvert”, line 11, in
sys.exit(main())
^^^^^^
File “/Users/jiten/anaconda3/lib/python3.11/site-packages/jupyter_core/application.py”, line 277, in launch_instance
return super().launch_instance(argv=argv, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/jiten/anaconda3/lib/python3.11/site-packages/traitlets/config/application.py”, line 992, in launch_instance
app.start()
File “/Users/jiten/anaconda3/lib/python3.11/site-packages/nbconvert/nbconvertapp.py”, line 423, in start
self.convert_notebooks()
File “/Users/jiten/anaconda3/lib/python3.11/site-packages/nbconvert/nbconvertapp.py”, line 585, in convert_notebooks
raise ValueError(
ValueError: Please specify an output format with ‘–to ’.
The following formats are available: [‘asciidoc’, ‘custom’, ‘html’, ‘latex’, ‘markdown’, ‘notebook’, ‘pdf’, ‘python’, ‘rst’, ‘script’, ‘slides’, ‘webpdf’]
(base) jiten@Jitens-MacBook-Air Masters % jupyter nbconvert account_database.ipynb --to html
[NbConvertApp] Converting notebook account_database.ipynb to html
Traceback (most recent call last):
File “/Users/jiten/anaconda3/bin/jupyter-nbconvert”, line 11, in
sys.exit(main())
^^^^^^
File “/Users/jiten/anaconda3/lib/python3.11/site-packages/jupyter_core/application.py”, line 277, in launch_instance
return super().launch_instance(argv=argv, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/jiten/anaconda3/lib/python3.11/site-packages/traitlets/config/application.py”, line 992, in launch_instance
app.start()
File “/Users/jiten/anaconda3/lib/python3.11/site-packages/nbconvert/nbconvertapp.py”, line 423, in start
self.convert_notebooks()
File “/Users/jiten/anaconda3/lib/python3.11/site-packages/nbconvert/nbconvertapp.py”, line 597, in convert_notebooks
self.convert_single_notebook(notebook_filename)
File “/Users/jiten/anaconda3/lib/python3.11/site-packages/nbconvert/nbconvertapp.py”, line 560, in convert_single_notebook
output, resources = self.export_single_notebook(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/jiten/anaconda3/lib/python3.11/site-packages/nbconvert/nbconvertapp.py”, line 488, in export_single_notebook
output, resources = self.exporter.from_filename(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/jiten/anaconda3/lib/python3.11/site-packages/nbconvert/exporters/exporter.py”, line 189, in from_filename
return self.from_file(f, resources=resources, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/jiten/anaconda3/lib/python3.11/site-packages/nbconvert/exporters/exporter.py”, line 206, in from_file
return self.from_notebook_node(
^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/jiten/anaconda3/lib/python3.11/site-packages/nbconvert/exporters/html.py”, line 223, in from_notebook_node
return super().from_notebook_node(nb, resources, **kw)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/jiten/anaconda3/lib/python3.11/site-packages/nbconvert/exporters/templateexporter.py”, line 413, in from_notebook_node
output = self.template.render(nb=nb_copy, resources=resources)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/jiten/anaconda3/lib/python3.11/site-packages/jinja2/environment.py”, line 1301, in render
self.environment.handle_exception()
File “/Users/jiten/anaconda3/lib/python3.11/site-packages/jinja2/environment.py”, line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File “/Users/jiten/.local/share/jupyter/nbconvert/templates/lab/index.html.j2”, line 1, in top-level template code
{%- extends ‘base.html.j2’ -%}
^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/jiten/anaconda3/lib/python3.11/site-packages/jinja2/environment.py”, line 936, in handle_exception
raise rewrite_traceback_stack(source=source)
File “/Users/jiten/.local/share/jupyter/nbconvert/templates/lab/base.html.j2”, line 314, in template
{{ output.data[datatype] | json_dumps | escape_html_script }}
^^^^^^^^^^^^^^^^^^^^^^^^^
jinja2.exceptions.TemplateAssertionError: No filter named ‘escape_html_script’

% jupyter --version
Selected Jupyter core packages…
IPython : 8.15.0
ipykernel : 6.25.0
ipywidgets : 8.0.4
jupyter_client : 7.4.9
jupyter_core : 5.3.0
jupyter_server : 1.23.4
jupyterlab : 3.6.3
nbclient : 0.5.13
nbconvert : 6.5.4
nbformat : 5.9.2
notebook : 6.5.4
qtconsole : 5.4.2
traitlets : 5.7.1

Please let me know if I am missing anything

welcome to the forum… try i.e.
jupyter nbconvert --to pdf

Thank you for the welcome.

I understand I can do multiple option but why is the html not working I need to html to submit as part of my work.
I am basically doing this via the jupyter notebook , in order to get the logs I ran that in a terminal.

Is there any update or fix being worked on ?
I believe there is a incompatibility issue with python 3.11.5

yes there are updates. for me, html export works fine with the --to html option, i have newer versions of pretty much everything.

1 Like