Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Erreur with date metadata #2109

Open
djangoliv opened this issue Feb 9, 2024 · 0 comments
Open

Erreur with date metadata #2109

djangoliv opened this issue Feb 9, 2024 · 0 comments

Comments

@djangoliv
Copy link

I can't export simple notebook in pdf with date in metadata.

The conversion fail with the following example:

{
 "cells": [
 ],
 "metadata": {
  "date": 1704808220.9683206
},
 "nbformat": 4,
 "nbformat_minor": 5
}

Traceback:

$ jupyter nbconvert --to pdf example.ipynb

 
[NbConvertApp] Converting notebook to_start.fr.ipynb to pdf
Traceback (most recent call last):
  File "/tmp/yy/bin/jupyter-nbconvert", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/tmp/yy/lib/python3.11/site-packages/jupyter_core/application.py", line 283, in launch_instance
    super().launch_instance(argv=argv, **kwargs)
  File "/tmp/yy/lib/python3.11/site-packages/traitlets/config/application.py", line 1075, in launch_instance
    app.start()
  File "/tmp/yy/lib/python3.11/site-packages/nbconvert/nbconvertapp.py", line 420, in start
    self.convert_notebooks()
  File "/tmp/yy/lib/python3.11/site-packages/nbconvert/nbconvertapp.py", line 597, in convert_notebooks
    self.convert_single_notebook(notebook_filename)
  File "/tmp/yy/lib/python3.11/site-packages/nbconvert/nbconvertapp.py", line 563, in convert_single_notebook
    output, resources = self.export_single_notebook(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/yy/lib/python3.11/site-packages/nbconvert/nbconvertapp.py", line 487, in export_single_notebook
    output, resources = self.exporter.from_filename(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/yy/lib/python3.11/site-packages/nbconvert/exporters/templateexporter.py", line 386, in from_filename
    return super().from_filename(filename, resources, **kw)  # type:ignore[return-value]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/yy/lib/python3.11/site-packages/nbconvert/exporters/exporter.py", line 201, in from_filename
    return self.from_file(f, resources=resources, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/yy/lib/python3.11/site-packages/nbconvert/exporters/templateexporter.py", line 392, in from_file
    return super().from_file(file_stream, resources, **kw)  # type:ignore[return-value]
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/yy/lib/python3.11/site-packages/nbconvert/exporters/exporter.py", line 220, in from_file
    return self.from_notebook_node(
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/yy/lib/python3.11/site-packages/nbconvert/exporters/pdf.py", line 184, in from_notebook_node
    latex, resources = super().from_notebook_node(nb, resources=resources, **kw)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/yy/lib/python3.11/site-packages/nbconvert/exporters/latex.py", line 92, in from_notebook_node
    return super().from_notebook_node(nb, resources, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/yy/lib/python3.11/site-packages/nbconvert/exporters/templateexporter.py", line 424, in from_notebook_node
    output = self.template.render(nb=nb_copy, resources=resources)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/yy/lib/python3.11/site-packages/jinja2/environment.py", line 1301, in render
    self.environment.handle_exception()
  File "/tmp/yy/lib/python3.11/site-packages/jinja2/environment.py", line 936, in handle_exception
    raise rewrite_traceback_stack(source=source)
  File "/tmp/yy/share/jupyter/nbconvert/templates/latex/index.tex.j2", line 8, in top-level template code
    ((* extends cell_style *))
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/yy/share/jupyter/nbconvert/templates/latex/style_jupyter.tex.j2", line 176, in top-level template code
    \prompt{(((prompt)))}{(((prompt_color)))}{(((execution_count)))}{(((extra_space)))}
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/yy/share/jupyter/nbconvert/templates/latex/base.tex.j2", line 7, in top-level template code
    ((*- extends 'document_contents.tex.j2' -*))
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/yy/share/jupyter/nbconvert/templates/latex/document_contents.tex.j2", line 51, in top-level template code
    ((*- block figure scoped -*))
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/yy/share/jupyter/nbconvert/templates/latex/display_priority.j2", line 5, in top-level template code
    ((*- extends 'null.j2' -*))
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/yy/share/jupyter/nbconvert/templates/latex/null.j2", line 28, in top-level template code
    ((*- block header -*))
    ^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/yy/share/jupyter/nbconvert/templates/latex/base.tex.j2", line 98, in block 'header'
    ((* block definitions *))
  File "/tmp/yy/share/jupyter/nbconvert/templates/latex/style_jupyter.tex.j2", line 11, in block 'definitions'
    ((( super() )))
^^^^^^^^^^^^^^^^^^^^
  File "/tmp/yy/share/jupyter/nbconvert/templates/latex/base.tex.j2", line 185, in block 'definitions'
    ((* block date *))
^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/yy/share/jupyter/nbconvert/templates/latex/base.tex.j2", line 187, in block 'date'
    \date{((( nb.metadata.date | escape_latex )))}
^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/yy/lib/python3.11/site-packages/nbconvert/filters/latex.py", line 57, in escape_latex
    text = "".join(LATEX_SUBS.get(c, c) for c in text)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'float' object is not iterable

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant