Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Traceback with Pillow and Python 3 [SF:bugs:237] #312

Closed
chrisjsewell opened this issue Aug 9, 2020 · 0 comments
Closed

Traceback with Pillow and Python 3 [SF:bugs:237] #312

chrisjsewell opened this issue Aug 9, 2020 · 0 comments

Comments

@chrisjsewell
Copy link
Owner

author: arfrever
created: 2013-06-12 17:02:00.114000
assigned: None
SF_url: https://sourceforge.net/p/docutils/bugs/237

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'

commenter: arfrever
posted: 2013-07-03 11:21:30.963000
title: #237 Traceback with Pillow and Python 3

I withdraw this suggestion. Pillow 2.1.0 will support bytes filenames:
python-pillow/Pillow#258


commenter: milde
posted: 2013-08-21 22:04:16.420000
title: #237 Traceback with Pillow and Python 3

  • status: open --> closed

commenter: milde
posted: 2017-10-25 07:16:45.206000
title: #237 Traceback with Pillow and Python 3

  • Group: repository --> Default
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant