Encountered this error using autoflask from sphinxcontrib-httpdomain. When
was used in a rst file, the command
$ make latexpdf
would result in the following error:
File "/Users/mizhi/Development/python/virtualenvs/flask/lib/python2.7/site-packages/sphinx/writers/latex.py", line 295, in generate
TypeError: expected a character buffer object
This small change eliminates the behavior. There are two versions of the translate method: one for ascii strings and one for unicode. The translate method for ascii strings expects a table that is a 256 character string. The unicode version of translate expects a dictionary. The translate method is using the tex_escape_map, which is a dictionary, so this change merely guarantees that the version being called is the unicode version.