question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Generating Indices fails when used with Spinx 1.4.1

See original GitHub issue

this is an example output:

$ sphinx-build -b pdf source build/pdf
Running Sphinx v1.4.1
loading pickled environment... done
building [mo]: targets for 0 po files that are out of date
building [pdf]: targets for 26 source files that are out of date
updating environment: 0 added, 0 changed, 0 removed
looking for now-outdated files... none found
processing PyMuPDF... index intro changes installation tutorial classes colorspace device displaylist document identity irect link linkdest matrix outline page pixmap point rect textpage textsheet functions vars app1 app2 [ERROR] pdfbuilder.py:130 too many values to unpack
Traceback (most recent call last):
  File "c:\python27\lib\site-packages\rst2pdf\pdfbuilder.py", line 122, in write
    appendices=opts.get('pdf_appendices', self.config.pdf_appendices) or [])
  File "c:\python27\lib\site-packages\rst2pdf\pdfbuilder.py", line 209, in assemble_doctree
    index_nodes=genindex_nodes(genindex)
  File "c:\python27\lib\site-packages\rst2pdf\pdfbuilder.py", line 385, in genindex_nodes
    for entryname, (links, subitems) in entries:
ValueError: too many values to unpack
FAILED
build succeeded.
$

Setting pdf_use_index = False in conf.py will get the document created - without index. I know that this same rst2pdf version worked with Sphinx 1.3.1.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

6reactions
fgerstenbergcommented, Apr 26, 2016

i came across the same problem a while ago. It seems the new Sphinx version reports an additional field in its index entries. currently line 385 in pdfbuilder.py reads as following:

        for entryname, (links, subitems) in entries:
            if links:
                output.append('`%s <#%s>`_'%(entryname,nodes.make_id(links[0][1])))
                for i,link in enumerate(links[1:]):
                    output[-1]+=(' `[%s] <#%s>`_ '%(i+1,nodes.make_id(link[1])))
                output.append('')

But since the second part of entries is now a list of length 3, you get the ValueError. Making the following changes will solve the error and should be compatible with the old format as well:

        for entryname, add_info in entries:
            links = add_info[0]
            subitems = add_info[1]
            if links:
                output.append('`%s <#%s>`_'%(entryname,nodes.make_id(links[0][1])))
                for i,link in enumerate(links[1:]):
                    output[-1]+=(' `[%s] <#%s>`_ '%(i+1,nodes.make_id(link[1])))
                output.append('')

This will simply drop the additional field. In every case i tested it had the value None anyway.

1reaction
pmaupincommented, Jun 13, 2016

Yeah, “on hiatus.”

Not enough hours in the day for everything that needs to be done…

Read more comments on GitHub >

github_iconTop Results From Across the Web

Changelog - Sphinx documentation
C, properly reject function declarations when a keyword is used as parameter name. #8933: viewcode: Failed to create back-links on parallel build. #8960:...
Read more >
Sphinx Documentation - Read the Docs
Index entries are generated. Also generates a link to the matching envvar directive, if it exists. :token: The name of a grammar token...
Read more >
How to create a PDF-out-of-Sphinx-documentation-tool
How can I use the sphinx-build command to generate PDF with rst2pdf custom styles. Currently the command: rst2pdf index.rst -s paamrstyles.txt ...
Read more >
Changelog — pyelasticsearch 1.4.1 documentation
Introduce new bulk API, supporting all types of bulk operations (index, update, create, and delete), providing chunking via bulk_chunks() ; Deprecate bulk_index ...
Read more >
What's new in 1.4.0 (January 22, 2022) - Pandas
Already existing columns are skipped, i.e. the next available index is used for the target column name (GH14704). >>> In [24]: import io...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found