You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The panflute filters implemented in filters_pandoc seem to assume that panflute version 1.x is installed. It looks as if panflute versions 2.x introduced a new class Caption to represent table captions, whereas in previous versions table captions were represented as lists. The ipypublish filters treat captions as lists and attempt to use e.g. iteration and subscripting directly on captions, resulting in
TypeError: 'Caption' object is not iterable
see below for full trace.
To Reproduce
Steps to reproduce the behavior:
Set up the conda environment below noting panflute 2.0.3.
Convert notebook(s) containing tables using nbconvert.
INFO:ipypublish:finding conversion configuration: latex_ipypublish_main
INFO:ipypublish:loading conversion configuration
INFO:ipypublish:creating exporter
INFO:ipypublish:creating template and loading filters
DEBUG:template:overwrite keys: []
DEBUG:template:overwrite keys: []
DEBUG:template:overwrite keys: []
DEBUG:template:overwrite keys: []
DEBUG:template:overwrite keys: []
DEBUG:template:overwrite keys: []
DEBUG:template:overwrite keys: []
DEBUG:template:overwrite keys: []
INFO:ipypublish:creating process configuration
INFO:ipypublish:running nbconvert
DEBUG:traitlets:Applying preprocessor: TagRemovePreprocessor
DEBUG:traitlets:Applying preprocessor: RegexRemovePreprocessor
DEBUG:traitlets:Applying preprocessor: coalesce_streams
DEBUG:traitlets:Applying preprocessor: SVG2PDFPreprocessor
DEBUG:traitlets:Applying preprocessor: LatexPreprocessor
DEBUG:traitlets:Applying preprocessor: HighlightMagicsPreprocessor
DEBUG:traitlets:Applying preprocessor: ExtractOutputPreprocessor
DEBUG:traitlets:Applying preprocessor: SplitOutputs
INFO:root:splitting outputs into separate cells
DEBUG:traitlets:Applying preprocessor: LatexDocLinks
INFO:resolve_links:resolving external file paths in ipub metadata to: slides/all/1_Overview_of_Python.ipynb
DEBUG:traitlets:Applying preprocessor: LatexCaptions
INFO:captions:extracting caption cells
DEBUG:traitlets:Attempting to load template template_file
DEBUG:traitlets: template_path: .
Run Failed: 'Caption' object is not iterable
Traceback (most recent call last):
File "/home/sphelps/anaconda3/envs/fitch-python/bin/nbpublish", line 11, in <module>
sys.exit(run())
File "/home/sphelps/anaconda3/envs/fitch-python/lib/python3.7/site-packages/ipypublish/frontend/nbpublish.py", line 100, in run
outcode = nbpublish(filepath, **options)
File "/home/sphelps/anaconda3/envs/fitch-python/lib/python3.7/site-packages/ipypublish/frontend/nbpublish.py", line 83, in nbpublish
publish(ipynb_path)
File "/home/sphelps/anaconda3/envs/fitch-python/lib/python3.7/site-packages/ipypublish/convert/main.py", line 354, in __call__
return self.publish(ipynb_path, nb_node)
File "/home/sphelps/anaconda3/envs/fitch-python/lib/python3.7/site-packages/ipypublish/convert/main.py", line 487, in publish
final_nb, exporter_cls, econfig, jinja_template
File "/home/sphelps/anaconda3/envs/fitch-python/lib/python3.7/site-packages/ipypublish/convert/main.py", line 615, in export_notebook
body, resources = exporter.from_notebook_node(final_nb)
File "/home/sphelps/anaconda3/envs/fitch-python/lib/python3.7/site-packages/nbconvert/exporters/latex.py", line 88, in from_notebook_node
return super(LatexExporter, self).from_notebook_node(nb, resources, **kw)
File "/home/sphelps/anaconda3/envs/fitch-python/lib/python3.7/site-packages/nbconvert/exporters/templateexporter.py", line 322, in from_notebook_node
output = self.template.render(nb=nb_copy, resources=resources)
File "/home/sphelps/anaconda3/envs/fitch-python/lib/python3.7/site-packages/jinja2/environment.py", line 1090, in render
self.environment.handle_exception()
File "/home/sphelps/anaconda3/envs/fitch-python/lib/python3.7/site-packages/jinja2/environment.py", line 832, in handle_exception
reraise(*rewrite_traceback_stack(source=source))
File "/home/sphelps/anaconda3/envs/fitch-python/lib/python3.7/site-packages/jinja2/_compat.py", line 28, in reraise
raise value.with_traceback(tb)
File "<template>", line 919, in top-level template code
File "/home/sphelps/anaconda3/envs/fitch-python/lib/python3.7/site-packages/nbconvert/exporters/../templates/latex/skeleton/display_priority.tplx", line 5, in top-level template code
((*- extends 'null.tplx' -*))
File "/home/sphelps/anaconda3/envs/fitch-python/lib/python3.7/site-packages/nbconvert/exporters/../templates/latex/skeleton/null.tplx", line 30, in top-level template code
((*- block body -*))
File "<template>", line 575, in block "body"
File "/home/sphelps/anaconda3/envs/fitch-python/lib/python3.7/site-packages/nbconvert/exporters/../templates/latex/skeleton/null.tplx", line 32, in block "body"
((*- block any_cell scoped -*))
File "<template>", line 624, in block "any_cell"
File "/home/sphelps/anaconda3/envs/fitch-python/lib/python3.7/site-packages/nbconvert/exporters/../templates/latex/skeleton/null.tplx", line 85, in block "any_cell"
((*- block markdowncell scoped-*)) ((*- endblock markdowncell -*))
File "<template>", line 651, in block "markdowncell"
File "/home/sphelps/anaconda3/envs/fitch-python/lib/python3.7/site-packages/ipypublish/filters_pandoc/main.py", line 214, in jinja_filter
strip_meta=bool(strip_meta),
File "/home/sphelps/anaconda3/envs/fitch-python/lib/python3.7/site-packages/ipypublish/filters_pandoc/utils.py", line 114, in apply_filter
out_doc = func(out_doc, **kwargs) # type: Doc
File "/home/sphelps/anaconda3/envs/fitch-python/lib/python3.7/site-packages/ipypublish/filters_pandoc/prepare_cites.py", line 131, in main
return pf.run_filter(process_citations, prepare, finalize, doc=doc)
File "/home/sphelps/anaconda3/envs/fitch-python/lib/python3.7/site-packages/panflute/io.py", line 224, in run_filter
return run_filters([action], *args, **kwargs)
File "/home/sphelps/anaconda3/envs/fitch-python/lib/python3.7/site-packages/panflute/io.py", line 205, in run_filters
doc = doc.walk(action, doc)
File "/home/sphelps/anaconda3/envs/fitch-python/lib/python3.7/site-packages/panflute/base.py", line 264, in walk
ans = list(chain.from_iterable(ans))
File "/home/sphelps/anaconda3/envs/fitch-python/lib/python3.7/site-packages/panflute/base.py", line 262, in <genexpr>
ans = ((item,) if type(item) != list else item for item in ans)
File "/home/sphelps/anaconda3/envs/fitch-python/lib/python3.7/site-packages/panflute/base.py", line 259, in <genexpr>
ans = (item.walk(action, doc) for item in obj)
File "/home/sphelps/anaconda3/envs/fitch-python/lib/python3.7/site-packages/panflute/base.py", line 275, in walk
altered = action(self, doc)
File "/home/sphelps/anaconda3/envs/fitch-python/lib/python3.7/site-packages/ipypublish/filters_pandoc/prepare_cites.py", line 62, in process_citations
for subel in initial_content:
TypeError: 'Caption' object is not iterable
The text was updated successfully, but these errors were encountered:
Bug Report
Describe the bug
The panflute filters implemented in
filters_pandoc
seem to assume that panflute version 1.x is installed. It looks as if panflute versions 2.x introduced a new classCaption
to represent table captions, whereas in previous versions table captions were represented as lists. The ipypublish filters treat captions as lists and attempt to use e.g. iteration and subscripting directly on captions, resulting inTypeError: 'Caption' object is not iterable
see below for full trace.
To Reproduce
Steps to reproduce the behavior:
nbconvert
.Runtime Information
Additional context
Add any other context about the problem here.
Logging
The text was updated successfully, but these errors were encountered: