#237 Traceback with Pillow and Python 3

repository
closed
nobody
None
5
2014-12-25
2013-06-12
Arfrever
No

Pillow is actively maintained fork of PIL. Pillow >=2.0.0 supports Python 3. Docutils passes a bytes argument to PIL.Image.open(), which expects a str argument.

$ cat test.rst
.. image:: file.png
   :scale: 50
$ rst2html.py-3.3 --traceback test.rst
Traceback (most recent call last):
  File "/usr/bin/rst2html.py-3.3", line 23, in <module>
    publish_cmdline(writer_name='html', description=description)
  File "/usr/lib64/python3.3/site-packages/docutils/core.py", line 352, in publish_cmdline
    config_section=config_section, enable_exit_status=enable_exit_status)
  File "/usr/lib64/python3.3/site-packages/docutils/core.py", line 219, in publish
    output = self.writer.write(self.document, self.destination)
  File "/usr/lib64/python3.3/site-packages/docutils/writers/__init__.py", line 80, in write
    self.translate()
  File "/usr/lib64/python3.3/site-packages/docutils/writers/html4css1/__init__.py", line 173, in translate
    self.document.walkabout(visitor)
  File "/usr/lib64/python3.3/site-packages/docutils/nodes.py", line 174, in walkabout
    if child.walkabout(visitor):
  File "/usr/lib64/python3.3/site-packages/docutils/nodes.py", line 166, in walkabout
    visitor.dispatch_visit(self)
  File "/usr/lib64/python3.3/site-packages/docutils/nodes.py", line 1627, in dispatch_visit
    return method(node)
  File "/usr/lib64/python3.3/site-packages/docutils/writers/html4css1/__init__.py", line 1036, in visit_image
    imagepath.encode(sys.getfilesystemencoding()))
  File "/usr/lib64/python3.3/site-packages/PIL/Image.py", line 1992, in open
    prefix = fp.read(16)
AttributeError: 'bytes' object has no attribute 'read'

Discussion

  • Günter Milde

    Günter Milde - 2013-08-21
    • status: open --> closed
     

Log in to post a comment.