Pngmath error handling code not compatible with Python 3

Bug #1184658 reported by Shriramana Sharma
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
sphinx (Ubuntu)
Fix Released
Low
Unassigned

Bug Description

Please refer to my thread at the upstream mailing list: https://groups.google.com/d/topic/sphinx-dev/FHgjgSYPYaU/discussion. It is not possible to use python3-sphinx on Raring for the simple reason that in Raring python3-sphinx is at v1.1.3 but python3 is at v3.3.1 and apparently one requires python3-sphinx v1.2 to use sphinx on python3 >= 3.3: see https://groups.google.com/d/msg/sphinx-dev/FHgjgSYPYaU/LffSg_-qCVEJ

It doesn't seem as if this can be fixed on raring unless raring-updates can get python3-sphinx. I submit this bug to keep track of this.

Console transcript showing bug:

# Sphinx version: 1.1.3
# Python version: 3.3.1
# Docutils version: 0.10 release
# Jinja2 version: 2.6
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/sphinx/ext/pngmath.py", line 188, in html_visit_math
    fname, depth = render_math(self, '$'+node['latex']+'$')
  File "/usr/lib/python3/dist-packages/sphinx/ext/pngmath.py", line 134, in render_math
    '[stdout]\n%s' % (stderr, stdout))
sphinx.ext.pngmath.MathExtError: latex exited with error:
[stderr]
b''
[stdout]
b"This is pdfTeX, Version 3.1415926-2.4-1.40.13 (TeX Live 2012/Debian)\n restricted \\write18 enabled.\nentering extended mode\n(./math.tex\nLaTeX2e <2011/06/27>\nBabel <v3.8m> and hyphenation patterns for english, dumylang, nohyphenation, lo\naded.\n(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls\nDocument Class: article 2007/10/19 v1.4h Standard LaTeX document class\n(/usr/share/texlive/texmf-dist/tex/latex/base/size12.clo))\n(/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty\n\n! LaTeX Error: File `utf8x.def' not found.\n\nType X to quit or <RETURN> to proceed,\nor enter new name. (Default extension: def)\n\nEnter file name: \n! Emergency stop.\n<read *> \n \nl.131 \\endinput\n ^^M\nNo pages of output.\nTranscript written on math.log.\n"

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/sphinx/cmdline.py", line 189, in main
    app.build(force_all, filenames)
  File "/usr/lib/python3/dist-packages/sphinx/application.py", line 204, in build
    self.builder.build_update()
  File "/usr/lib/python3/dist-packages/sphinx/builders/__init__.py", line 196, in build_update
    'out of date' % len(to_build))
  File "/usr/lib/python3/dist-packages/sphinx/builders/__init__.py", line 252, in build
    self.write(docnames, list(updated_docnames), method)
  File "/usr/lib/python3/dist-packages/sphinx/builders/__init__.py", line 292, in write
    self.write_doc(docname, doctree)
  File "/usr/lib/python3/dist-packages/sphinx/builders/html.py", line 419, in write_doc
    self.docwriter.write(doctree, destination)
  File "/usr/lib/python3/dist-packages/docutils/writers/__init__.py", line 80, in write
    self.translate()
  File "/usr/lib/python3/dist-packages/sphinx/writers/html.py", line 38, 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):
  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 166, in walkabout
    visitor.dispatch_visit(self)
  File "/usr/lib/python3/dist-packages/docutils/nodes.py", line 1627, in dispatch_visit
    return method(node)
  File "/usr/lib/python3/dist-packages/sphinx/ext/pngmath.py", line 190, in html_visit_math
    msg = str(str(exc), 'utf-8', 'replace')
TypeError: decoding str is not supported

Revision history for this message
Shriramana Sharma (jamadagni) wrote :

See also:

Upstream changelog documenting this fix for v1.2(devel):
https://bitbucket.org/birkenfeld/sphinx/src/72dceb35264e9429c8d9bb1a249a638ac21f0524/CHANGES?at=default#cl-227

Upstream bug (now fixed in trunk as per changelog above):
https://bitbucket.org/birkenfeld/sphinx/issue/1008/test-failures-with-python-33

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in sphinx (Ubuntu):
status: New → Confirmed
Revision history for this message
Xavier Gnata (xavier-gnata-gmail) wrote :
Revision history for this message
Dmitry Shachnev (mitya57) wrote :

Our Sphinx package has python3 support patches backported from upstream. This traceback looks like a minor issue in pngmath extension, forwarded to <https://bitbucket.org/birkenfeld/sphinx/issue/1207/>.

Changed in sphinx (Ubuntu):
status: Confirmed → Triaged
importance: Undecided → Low
summary: - python3-sphinx is not usable on Raring
+ Pngmath error handling code not compatible with Python 3
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package sphinx - 1.2.1+dfsg-2ubuntu1

---------------
sphinx (1.2.1+dfsg-2ubuntu1) trusty; urgency=medium

  * Merge with Debian unstable.
    - New upstream release fixes pngmath error handling code
      (LP: #1184658).
  * Remaining changes:
    - Export NO_PKG_MANGLE=1 in order to not have translations stripped.
    - debian/control: Drop the build-dependency on python-whoosh.
 -- Dmitry Shachnev <email address hidden> Fri, 24 Jan 2014 16:17:13 +0400

Changed in sphinx (Ubuntu):
status: Triaged → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.