From: Subject: dblatex: do not error on gtk-doc tests/gobject tests For unknow reason, python3 bytes (b'...') comes in where not should, and str ("...") where bytes are expected. One or other bombs out on gtk-doc package %check . cd tests/gobject/docs /bin/dblatex -o tester.pdf -I ./images -x '--path /home/kabe/c8builds/gtk-doc-c8/BUILD/gtk-doc-1.28/tests/gobject/docs:/home/kabe/c8builds/gtk-doc-c8/BUILD/gtk-doc-1.28/tests/gobject/examples' tester-docs.xml ... Missing character ╰ Missing character ─ Missing character ─ Unexpected error occured Error: sequence item 0: expected str instance, bytes found diff -up /usr/lib/python3.6/site-packages/dbtexmf/dblatex/rawtex.py.dist /usr/lib/python3.6/site-packages/dbtexmf/dblatex/rawtex.py --- /usr/lib/python3.6/site-packages/dbtexmf/dblatex/rawtex.py.dist 2019-05-14 08:22:19.000000000 +0900 +++ /usr/lib/python3.6/site-packages/dbtexmf/dblatex/rawtex.py 2021-08-20 00:33:27.770242877 +0900 @@ -94,6 +94,9 @@ class RawLatex: fig = m[1] newfig = self.image.convert(fig) + # convert to bytes if str was returned + if isinstance(fig, str): fig = fig.encode("latin-1", "ignore") + if isinstance(newfig, str): newfig = newfig.encode("latin-1", "ignore") # If something done, replace the figure in the tex file if newfig != fig: line = re.sub(br"{%s}" % fig, br"{%s}" % newfig, line) diff -up /usr/lib/python3.6/site-packages/dbtexmf/dblatex/texcodec.py.dist /usr/lib/python3.6/site-packages/dbtexmf/dblatex/texcodec.py --- /usr/lib/python3.6/site-packages/dbtexmf/dblatex/texcodec.py.dist 2019-05-14 08:22:19.000000000 +0900 +++ /usr/lib/python3.6/site-packages/dbtexmf/dblatex/texcodec.py 2021-08-20 00:13:59.219730001 +0900 @@ -13,6 +13,10 @@ tex_handler_installed = {} tex_handler_counter = {} def latex_char_replace(exc, pre, post, name): + # for unknown reason, sometimes bytes are passed as pre, post + # otherwise join(l) below bombs out + if isinstance(pre, bytes): pre = pre.decode("latin-1") + if isinstance(post, bytes): post = post.decode("latin-1") global tex_handler_counter if not isinstance(exc, UnicodeEncodeError): raise TypeError("don't know how to handle %r" % exc)