Re: rst2odt can't handle images in python 3: AttributeError: 'str' object has no attribute 'decode'
engelbert gruber <[email protected]>
| Newsgroups | gmane.text.docutils.user |
|---|---|
| Message-ID | <CAHnbgBOE+Y0CwLE5G8nziY629FYiXgbhYXMG1a=cNfW5oq5VYg@mail.gmail.com> |
that is a python3 problem not an encoding problem
i removed .decode('latin-1').encode('utf-8')
1. latin1 as input is an assumption
2. changing the name without the reference , might break things
3. decode/encode should happen in docutils.io (IMHO)
cheers
On 11 February 2015 at 08:54, Jorge Scandaliaris <[email protected]> wrote:
> 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/
> _______________________________________________
> Docutils-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/docutils-users
>
> Please use "Reply All" to reply to the list.
------------------------------------------------------------------------------
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/