rst2odt can't handle images in python 3: AttributeError: 'str' object has no attribute 'decode'

Jorge Scandaliaris <[email protected]>
Newsgroups gmane.text.docutils.user
Message-ID <[email protected]>
Hi,
I found an old reference for this problem in Debian's bug tracker [1], where
it was mentioned that a solution was introduced in 0.11-1. I have the same
problem on 0.12 and python 3.4. I have manually applied the changes that I
found in [2] and the problem is solved here. Is it possible that the fix was
applied by Debian and not upstream?


Jorge

[1] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=714313
[2] http://sourceforge.net/p/docutils/patches/113/

Minimal example triggering the bug (copy/paste between ---, adapt to use an
existing image):
---------------------------------
####
Test
####

.. image:: images/test.png
----------------------------------

Result:

Traceback (most recent call last):
  File "/usr/bin/rst2odt", line 29, in <module>
    description=description)
  File "/usr/lib/python3.4/site-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.4/site-packages/docutils/core.py", line 219, in publish
    output = self.writer.write(self.document, self.destination)
  File "/usr/lib/python3.4/site-packages/docutils/writers/__init__.py", line
80, in write
    self.translate()
  File
"/usr/lib/python3.4/site-packages/docutils/writers/odf_odt/__init__.py",
line 554, in translate
    self.assemble_my_parts()
  File
"/usr/lib/python3.4/site-packages/docutils/writers/odf_odt/__init__.py",
line 573, in assemble_my_parts
    self.store_embedded_files(zfile)
  File
"/usr/lib/python3.4/site-packages/docutils/writers/odf_odt/__init__.py",
line 598, in store_embedded_files
    destination1 = destination.decode('latin-1').encode('utf-8')
AttributeError: 'str' object has no attribute 'decode


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.