This exception occurs because apparently ConfigParser
already decodes the strings it returns somehow. Tested on a Debian Jessie system, using 3.4.2. To reproduce:
$ touch test.rst
$ echo -e '[Formats]\nfoo=bar' > test.ini
$ python3 /usr/share/docutils/scripts/python3/rst2odt --traceback --odf-config-file=test.ini test.rst test.odt
test.rst:: (WARNING/2) Style "foo" is not a style used by odtwriter.
Traceback (most recent call last):
File "/usr/share/docutils/scripts/python3/rst2odt", line 29, in <module>
description=description)
File "/usr/lib/python3/dist-packages/docutils/core.py", line 551, in publish_cmdline_to_binary
config_section=config_section, enable_exit_status=enable_exit_status)
File "/usr/lib/python3/dist-packages/docutils/core.py", line 219, in publish
output = self.writer.write(self.document, self.destination)
File "/usr/lib/python3/dist-packages/docutils/writers/init.py", line 80, in write
self.translate()
File "/usr/lib/python3/dist-packages/docutils/writers/odf_odt/init.py", line 550, in translate
self.visitor = self.translator_class(self.document)
File "/usr/lib/python3/dist-packages/docutils/writers/odf_odt/init.py", line 807, in init
self.format_map[rststyle] = format.decode('utf-8')
AttributeError: 'str' object has no attribute 'decode'
This was using docutils 0.12, but a quick look at the relevant file in trunk shows the decode still happens, so I suspect this is still broken with trunk.
Fixed.
Dave K
On Wed, Jun 28, 2017 at 10:34:38PM +0000, "Günter Milde" via Docutils-develop wrote:
--
Dave Kuhlman
http://www.davekuhlman.org
Related
Bugs:
#282Closing. Thanks for the fix.