brechtm / rinohtype

The Python document processor
http://www.mos6581.org/rinohtype
GNU Affero General Public License v3.0
499 stars 59 forks source link

rinoh.layout.ContainerOverflow: 9 #315

Closed khink closed 2 years ago

khink commented 2 years ago

I found this issue in version 0.5.3, reproduced it with the master branch (using pip install git+https://github.com/brechtm/rinohtype.git@master).

  1. The messages output by rinohtype (and Sphinx) when rendering the document.
$ sphinx-build -b rinoh . _build/rinoh
Running Sphinx v4.3.2
loading translations [nl]... done
loading intersphinx inventory from https://docs.python.org/objects.inv...
intersphinx inventory has moved: https://docs.python.org/objects.inv -> https://docs.python.org/3/objects.inv
building [mo]: targets for 0 po files that are out of date
building [rinoh]: all documents
updating environment: [new config] 6 added, 0 changed, 0 removed
reading sources... [100%] site-administration/beheer                                                                                                                                                               
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
processing myproject... index inleiding site-administration/beheer platform/platform security-document/beveiliging security-document/risicoanalyse resolving references...
Pygments lexer name 'csv' is not known
rinohtype 0.5.4 (in development)  Copyright (c) Brecht Machiels and contributors
This program comes with ABSOLUTELY NO WARRANTY. Its use is subject
to the terms of the GNU Affero General Public License version 3.
rendering... 
TeX Gyre Pagella does not include a normal medium upright font. Falling back to normal regular upright
Tab space exceeded. (page 4)                  ] ETA 00:15 (00:01) page 4
Tab space exceeded. (page 5)                  ] ETA 00:11 (00:01) page 5
Tab space exceeded. (page 6)                  ] ETA 00:09 (00:01) page 6
Tab space exceeded. (page 7)                  ] ETA 00:08 (00:02) page 7
Tab space exceeded. (page 8)                  ] ETA 00:10 (00:02) page 8
Tab space exceeded. (page 9)                  ] ETA 00:09 (00:03) page 9

Exception occurred:
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/layout.py", line 265, in advance
    raise ContainerOverflow(self.page.number)
rinoh.layout.ContainerOverflow: 9
The full traceback has been saved in /tmp/sphinx-err-07if901b.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
  1. A link to the source files (e.g. Sphinx project): I'll email this

  2. Please also provide the following information:

    • rinohtype version: (output from rinoh --version)
    • Sphinx version: (output from sphinx-build --version)
    • Python version: (output from python --version)
    • operating system: (Windows, Linux, MacOS)
# Sphinx version: 4.3.2
# Python version: 3.9.9 (CPython)
# Docutils version: 0.17.1 release
# Jinja2 version: 3.0.3
# Last messages:
#   done
#   processing myproject...
#   index
#   inleiding
#   site-administration/beheer
#   platform/platform
#   security-document/beveiliging
#   security-document/risicoanalyse
#   resolving references...
#   rendering...
# Loaded extensions:
#   sphinx.ext.mathjax (4.3.2) from /home/kees/Projects/my_project/env/lib/python3.9/site-packages/sphinx/ext/mathjax.py
#   sphinxcontrib.applehelp (1.0.2) from /home/kees/Projects/my_project/env/lib/python3.9/site-packages/sphinxcontrib/applehelp/__init__.py
#   sphinxcontrib.devhelp (1.0.2) from /home/kees/Projects/my_project/env/lib/python3.9/site-packages/sphinxcontrib/devhelp/__init__.py
#   sphinxcontrib.htmlhelp (2.0.0) from /home/kees/Projects/my_project/env/lib/python3.9/site-packages/sphinxcontrib/htmlhelp/__init__.py
#   sphinxcontrib.serializinghtml (1.1.5) from /home/kees/Projects/my_project/env/lib/python3.9/site-packages/sphinxcontrib/serializinghtml/__init__.py
#   sphinxcontrib.qthelp (1.0.3) from /home/kees/Projects/my_project/env/lib/python3.9/site-packages/sphinxcontrib/qthelp/__init__.py
#   alabaster (0.7.12) from /home/kees/Projects/my_project/env/lib/python3.9/site-packages/alabaster/__init__.py
#   sphinx.ext.autodoc.preserve_defaults (1.0) from /home/kees/Projects/my_project/env/lib/python3.9/site-packages/sphinx/ext/autodoc/preserve_defaults.py
#   sphinx.ext.autodoc.type_comment (4.3.2) from /home/kees/Projects/my_project/env/lib/python3.9/site-packages/sphinx/ext/autodoc/type_comment.py
#   sphinx.ext.autodoc (4.3.2) from /home/kees/Projects/my_project/env/lib/python3.9/site-packages/sphinx/ext/autodoc/__init__.py
#   sphinx.ext.doctest (4.3.2) from /home/kees/Projects/my_project/env/lib/python3.9/site-packages/sphinx/ext/doctest.py
#   sphinx.ext.intersphinx (4.3.2) from /home/kees/Projects/my_project/env/lib/python3.9/site-packages/sphinx/ext/intersphinx.py
#   sphinx.ext.todo (4.3.2) from /home/kees/Projects/my_project/env/lib/python3.9/site-packages/sphinx/ext/todo.py
#   sphinx.ext.coverage (4.3.2) from /home/kees/Projects/my_project/env/lib/python3.9/site-packages/sphinx/ext/coverage.py
#   sphinx.ext.graphviz (4.3.2) from /home/kees/Projects/my_project/env/lib/python3.9/site-packages/sphinx/ext/graphviz.py
#   sphinx.ext.imgmath (4.3.2) from /home/kees/Projects/my_project/env/lib/python3.9/site-packages/sphinx/ext/imgmath.py
#   sphinx.ext.ifconfig (4.3.2) from /home/kees/Projects/my_project/env/lib/python3.9/site-packages/sphinx/ext/ifconfig.py
#   sphinx.ext.viewcode (4.3.2) from /home/kees/Projects/my_project/env/lib/python3.9/site-packages/sphinx/ext/viewcode.py
#   rinoh.frontend.sphinx (0.5.4) from /home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/frontend/sphinx/__init__.py
Traceback (most recent call last):
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/sphinx/cmd/build.py", line 280, in build_main
    app.build(args.force_all, filenames)
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/sphinx/application.py", line 344, in build
    self.builder.build_update()
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/sphinx/builders/__init__.py", line 291, in build_update
    self.build(['__all__'], to_build)
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/sphinx/builders/__init__.py", line 358, in build
    self.write(docnames, list(updated_docnames), method)
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/frontend/sphinx/__init__.py", line 252, in write
    self.write_document(entry)
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/frontend/sphinx/__init__.py", line 262, in write_document
    rinoh_document.render(outfilename)
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/document.py", line 418, in render
    self.part_page_counts = self._render_pages()
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/document.py", line 458, in _render_pages
    part_page_count += part.render(part_page_count.count + 1)
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/template.py", line 398, in render
    page.render()
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/document.py", line 171, in render
    super().render(CONTENT, rerender=index > 0)
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/layout.py", line 186, in render
    child.render(type, rerender)
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/layout.py", line 186, in render
    child.render(type, rerender)
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/layout.py", line 287, in render
    self._render(type, rerender)
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/layout.py", line 342, in _render
    self.chain.render(self, rerender=rerender)
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/layout.py", line 615, in render
    self.flowables.flow(container, last_descender=None,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 227, in flow
    self.flow_inner(margin_container, last_descender, state=state,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 282, in flow_inner
    self.render(pad_cntnr, last_descender, state=state,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 516, in render
    self._flow_with_next(state, container, descender,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 547, in _flow_with_next
    flowable.flow(maybe_container, descender,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 227, in flow
    self.flow_inner(margin_container, last_descender, state=state,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 282, in flow_inner
    self.render(pad_cntnr, last_descender, state=state,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 516, in render
    self._flow_with_next(state, container, descender,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 547, in _flow_with_next
    flowable.flow(maybe_container, descender,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 227, in flow
    self.flow_inner(margin_container, last_descender, state=state,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 282, in flow_inner
    self.render(pad_cntnr, last_descender, state=state,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 516, in render
    self._flow_with_next(state, container, descender,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 547, in _flow_with_next
    flowable.flow(maybe_container, descender,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 227, in flow
    self.flow_inner(margin_container, last_descender, state=state,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 282, in flow_inner
    self.render(pad_cntnr, last_descender, state=state,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 516, in render
    self._flow_with_next(state, container, descender,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 547, in _flow_with_next
    flowable.flow(maybe_container, descender,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 227, in flow
    self.flow_inner(margin_container, last_descender, state=state,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 282, in flow_inner
    self.render(pad_cntnr, last_descender, state=state,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 516, in render
    self._flow_with_next(state, container, descender,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 547, in _flow_with_next
    flowable.flow(maybe_container, descender,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 227, in flow
    self.flow_inner(margin_container, last_descender, state=state,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 282, in flow_inner
    self.render(pad_cntnr, last_descender, state=state,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 516, in render
    self._flow_with_next(state, container, descender,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 547, in _flow_with_next
    flowable.flow(maybe_container, descender,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 227, in flow
    self.flow_inner(margin_container, last_descender, state=state,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 282, in flow_inner
    self.render(pad_cntnr, last_descender, state=state,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 516, in render
    self._flow_with_next(state, container, descender,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 547, in _flow_with_next
    flowable.flow(maybe_container, descender,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 227, in flow
    self.flow_inner(margin_container, last_descender, state=state,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 282, in flow_inner
    self.render(pad_cntnr, last_descender, state=state,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 516, in render
    self._flow_with_next(state, container, descender,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 547, in _flow_with_next
    flowable.flow(maybe_container, descender,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 227, in flow
    self.flow_inner(margin_container, last_descender, state=state,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 282, in flow_inner
    self.render(pad_cntnr, last_descender, state=state,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 817, in render
    return super().render(container, descender, state=state,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 516, in render
    self._flow_with_next(state, container, descender,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 547, in _flow_with_next
    flowable.flow(maybe_container, descender,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 227, in flow
    self.flow_inner(margin_container, last_descender, state=state,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 282, in flow_inner
    self.render(pad_cntnr, last_descender, state=state,
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/flowable.py", line 761, in render
    container.advance(label_height)
  File "/home/kees/Projects/my_project/env/lib/python3.9/site-packages/rinoh/layout.py", line 265, in advance
    raise ContainerOverflow(self.page.number)
rinoh.layout.ContainerOverflow: 9

Note: "my_project" and "myproject" have replaced the real project name.

khink commented 2 years ago

Update: This was caused by a table that was too wide:

=================== ========= =================== ===== ============================= =========
xxxx                xxx       xxxxxx xxxx xxxx    xxxx  xxxxx                         xxxxxxx
=================== ========= =================== ===== ============================= =========
xxxxxxxxxxxxxxxxx   xxxxx     xxxxxxxxxxxxxxxxxxx xxxx  xxxx xxxxxxxxxx               xxxxxxxxx
xxxxxxxxxxxx        xxxxx     xxxxxxxx            xxxx  xxxx xxxxxxxx                 xxxxxxxxx
xxxxxxxxxxxxx       xxxxx                         xxxx  xxxxxxxxx xxxxxxxxxxxxxxxxxxx xxxxxxxxx
xxxxxxxx            xxxxx     xxxxxxxx            xxxx  xxxxxxxx                      xxxxxxxxx
xxxxxxxxxxxx        xxxxx     xxxxxxxxxxx         xxxx  xxxxxxxxxxxx                  xxxxxxxxx
xxxxxxxxxxx         xxxxx     xxxxxxxxxxx         xxxx  xxxx xxxxxxxxxxx              xxxxxxx
xxxxxxxxxxxxxx      xxxxx     xxxxxxxxxxxxxx      xxxx  xxxxxxxxxxxxxxx               xxxxxxxxx
xxxx xxxxxxx        xxxxxxxxx xxxx xxxxxxx        xxxx  xxxx xxxxxxxxxxx              xxxxxxxxx
xxxxxxx xxxxxxxxxxx xxxxxxxxx xxxxxxx xxxxxxxxxxx xxxx  xxxxxxxxxxxx                  xxxxxxxxx
xxxxxxx xxxxxxxxxxx xxxxxxxxx xxxxxxx xxxxxxxxxxx xxxx  xxxxxxxxxxxx                  xxxxxxxxx
xxxxx xxxxxx        xxxxxxxxx xxxxx xxxxxx        xxxx  xxxxxxxxxxxx                  xxxxxxxxx
xxxxxxxxxx xxxxxxx  xxxxxxxxx xxxxxxxxxx xxxxxxx  xxxx  xxxxxxxxxxxx                  xxxxxxxxx
xxxxxxxx xxxxxxxx   xxxxxxxxx                           xxxxxxxxxxxx
xxxxxxxxxxxx        xxxxxxx   xxxxx               xxxx  xxxxxxxxx                     xxxxxxxxx
=================== ========= =================== ===== ============================= =========
brechtm commented 2 years ago

Hi @khink. Thank you for the bug report. I've only found time now to look into this, unfortunately. But it sound like you have been able to find the cause and sidestep the problem. 👍

I'm still interested to find out what was causing this. A wide table should not be triggering a ContainerOverflow. However, I am unable to reproduce the issue with the files you sent me. I think this is because you purged some files from the Sphinx project before zipping it up. Do you think it would be possible to send me the project that triggers this issue?

khink commented 2 years ago

Hi @brechtm, thanks for looking into it! I too see now that the files i sent you did not reproduce the issue, sorry about that. New files are in the mail.

khink commented 2 years ago

Hi @brechtm, thanks for your quick response to my email. Indeed, when i install rinohtype from git (instead of 0.5.3), the error does not occur anymore. Problem solved indeed!

brechtm commented 2 years ago

For completeness: fixed in 54795a473342b3246e997177a78262933726c086