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

Sphinx 1.8, generating latex causes error "KeyError: 'prefix'" #5519

Closed
adawastos opened this issue Oct 10, 2018 · 5 comments
Closed

Sphinx 1.8, generating latex causes error "KeyError: 'prefix'" #5519

adawastos opened this issue Oct 10, 2018 · 5 comments

Comments

@adawastos
Copy link

Subject: latexpdf "KeyError: 'prefix'"

Problem

  • While generating latex source from markdown document (with embedding rst code fragments) ended with an exception saying "KeyError: 'prefix'"

Procedure to reproduce the problem

make latexpdf

Error logs / results

# Sphinx version: 1.8.1
# Python version: 3.6.6 (CPython)
# Docutils version: 0.14 
# Jinja2 version: 2.10
# Last messages:
#   5_how_to_use_security_functions
#   
#   6_difficult_problems
#   
#   
#   
#   resolving references...
#   
#   writing...
#   
# Loaded extensions:
#   sphinx.ext.mathjax (1.8.1) from /usr/local/lib/python3.6/dist-packages/Sphinx-1.8.1-py3.6.egg/sphinx/ext/mathjax.py
#   alabaster (0.7.8) from /usr/lib/python3/dist-packages/alabaster/__init__.py
#   unicode_ids (2.0.5) from sphinxcontrib/unicode_ids/unicode_ids.py
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/Sphinx-1.8.1-py3.6.egg/sphinx/cmd/build.py", line 304, in build_main
    app.build(args.force_all, filenames)
  File "/usr/local/lib/python3.6/dist-packages/Sphinx-1.8.1-py3.6.egg/sphinx/application.py", line 341, in build
    self.builder.build_update()
  File "/usr/local/lib/python3.6/dist-packages/Sphinx-1.8.1-py3.6.egg/sphinx/builders/__init__.py", line 342, in build_update
    self.build(['__all__'], to_build)
  File "/usr/local/lib/python3.6/dist-packages/Sphinx-1.8.1-py3.6.egg/sphinx/builders/__init__.py", line 412, in build
    self.write(docnames, list(updated_docnames), method)
  File "/usr/local/lib/python3.6/dist-packages/Sphinx-1.8.1-py3.6.egg/sphinx/builders/latex/__init__.py", line 220, in write
    docwriter.write(doctree, destination)
  File "/usr/lib/python3/dist-packages/docutils/writers/__init__.py", line 80, in write
    self.translate()
  File "/usr/local/lib/python3.6/dist-packages/Sphinx-1.8.1-py3.6.egg/sphinx/writers/latex.py", line 202, in translate
    self.document.walkabout(visitor)
  File "/usr/lib/python3/dist-packages/docutils/nodes.py", line 174, in walkabout
    if child.walkabout(visitor):
  File "/usr/lib/python3/dist-packages/docutils/nodes.py", line 174, in walkabout
    if child.walkabout(visitor):
  File "/usr/lib/python3/dist-packages/docutils/nodes.py", line 174, in walkabout
    if child.walkabout(visitor):
  [Previous line repeated 2 more times]
  File "/usr/lib/python3/dist-packages/docutils/nodes.py", line 166, in walkabout
    visitor.dispatch_visit(self)
  File "/usr/lib/python3/dist-packages/docutils/nodes.py", line 1882, in dispatch_visit
    return method(node)
  File "/usr/local/lib/python3.6/dist-packages/Sphinx-1.8.1-py3.6.egg/sphinx/writers/latex.py", line 1476, in visit_enumerated_list
    (enum, node['prefix'], enum, node['suffix']))
  File "/usr/lib/python3/dist-packages/docutils/nodes.py", line 567, in __getitem__
    return self.attributes[key]
KeyError: 'prefix'

Expected results

  • generating proper latex source file, compile, beautiful pdf output.

Reproducible project / your project

  • sorry no avail

Environment info

  • OS: Linux Ubuntu 18.04 LTS
  • Python version: 3.6.6
  • Sphinx version: 1.8.1
@adawastos
Copy link
Author

Additional info:
I recently updated to Sphinx v1.8.1
It has been working fine with Sphinx v1.7.6.

@tirkarthi
Copy link

Possibly fixed with af63993 ? This handles the KeyError using get that defaults to None and seems there is some difference in CommonMark spec markdown files as I can see from the commit. Can you try installing sphinx from master as below?

pip install git+git://github.com/sphinx-doc/sphinx.git@eb44c73b81ff4e603d9452018d145ff3c204f71f

Thanks

@adawastos
Copy link
Author

adawastos commented Oct 12, 2018 via email

@tirkarthi
Copy link

@adawastos You're welcome :)

@tk0miya
Copy link
Member

tk0miya commented Oct 15, 2018

Thank you for reporting.
This was fixed at #5490, and it will be released in next stable release.

Thanks,

@tk0miya tk0miya closed this as completed Oct 15, 2018
@tk0miya tk0miya added this to the 1.8.2 milestone Oct 15, 2018
Tiryoh added a commit to yukixx6/raspimouse_sim_tutorial that referenced this issue Oct 16, 2018
Error shown on sphinx 1.8.1:
return self.attributes[key] KeyError: 'prefix' sphinx

This error will be fixed on 1.8.2.
sphinx-doc/sphinx#5519
christophevg added a commit to christophevg/pypi-template that referenced this issue Nov 3, 2018
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants