Building pandas documentation in latex fails with exception in sphinx/highlighting.py

Anonymous avatarAnonymous created an issue

I was trying to build the pandas documentation in latex format.

$ git clone git clone https://github.com/pydata/pandas.git $ cd pandas $ sudo python setup.py install $ python make.py html <success with various warnings> $ python make.py latex <fails>

Here's the tail of the build output:

--8<---------------cut here---------------start------------->8--- ... resolving references... writing... /home/nick/src/python/pandas/doc/source/index.rst:: WARNING: unusable reference target found: pandas.pdf /home/nick/src/python/pandas/doc/source/index.rst:: WARNING: unusable reference target found: pandas.zip

Exception occurred: File "/usr/lib/python2.7/site-packages/sphinx/highlighting.py", line 210, in highlight_block return hlsource.translate(tex_hl_escape_map_new) TypeError: expected a character buffer object The full traceback has been saved in /tmp/sphinx-err-Ho21Ro.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. Either send bugs to the mailing list at http://groups.google.com/group/sphinx-dev/, or report them in the tracker at http://bitbucket.org/birkenfeld/sphinx/issues/. Thanks! Building LaTeX failed. --8<---------------cut here---------------end--------------->8---

Here's the backtrace from /tmp/sphinx-err-Ho21Ro.log:

--8<---------------cut here---------------start------------->8---

Sphinx version: 1.1.3

Python version: 2.7.3

Docutils version: 0.10 repository

Jinja2 version: 2.6

Traceback (most recent call last): File "/usr/lib/python2.7/site-packages/sphinx/cmdline.py", line 189, in main app.build(force_all, filenames) File "/usr/lib/python2.7/site-packages/sphinx/application.py", line 204, in build self.builder.build_update() File "/usr/lib/python2.7/site-packages/sphinx/builders/init.py", line 191, in build_update self.build(['all'], to_build) File "/usr/lib/python2.7/site-packages/sphinx/builders/init.py", line 252, in build self.write(docnames, list(updated_docnames), method) File "/usr/lib/python2.7/site-packages/sphinx/builders/latex.py", line 104, in write docwriter.write(doctree, destination) File "/usr/lib/python2.7/site-packages/docutils/writers/init.py", line 80, in write self.translate() File "/usr/lib/python2.7/site-packages/sphinx/writers/latex.py", line 94, in translate self.document.walkabout(visitor) File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 173, in walkabout if child.walkabout(visitor): File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 173, in walkabout if child.walkabout(visitor): File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 173, in walkabout if child.walkabout(visitor): File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 173, in walkabout if child.walkabout(visitor): File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 173, in walkabout if child.walkabout(visitor): File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 173, in walkabout if child.walkabout(visitor): File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 173, in walkabout if child.walkabout(visitor): File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 186, in walkabout visitor.dispatch_departure(self) File "/usr/lib/python2.7/site-packages/docutils/nodes.py", line 1624, in dispatch_departure return method(node) File "/usr/lib/python2.7/site-packages/sphinx/writers/latex.py", line 1312, in depart_literal_block linenos=linenos, **highlight_args) File "/usr/lib/python2.7/site-packages/sphinx/highlighting.py", line 210, in highlight_block return hlsource.translate(tex_hl_escape_map_new) TypeError: expected a character buffer object --8<---------------cut here---------------end--------------->8---

Comments (1)

  1. foobaron

    FYI, I got the same error message from docutils.writers.latex2e.LatexTranslator.visit_math() line 2508.

    the code assumes node.astext() will return a unicode string. But I found that it was returning an empty string, which then throws this error message when its translate() method is called. Forcing the conversion to unicode via

    unicode(node.astext()).translate(...)
    

    fixes the problem. Not sure if that is helpful for this issue...

  2. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.