Skip to content

im.show: AttributeError: 'int' object has no attribute 'write' #3517

Description

@hugovk

What did you do?

im.show() on Mac.

What did you expect to happen?

It to show the image in Preview.app.

What actually happened?

Traceback (most recent call last):
  File "1.py", line 3, in <module>
    im.show()
  File "/Users/hugo/github/Pillow/src/PIL/Image.py", line 2035, in show
    _show(self, title=title, command=command)
  File "/Users/hugo/github/Pillow/src/PIL/Image.py", line 2900, in _show
    _showxv(image, **options)
  File "/Users/hugo/github/Pillow/src/PIL/Image.py", line 2905, in _showxv
    ImageShow.show(image, title, **options)
  File "/Users/hugo/github/Pillow/src/PIL/ImageShow.py", line 53, in show
    if viewer.show(image, title=title, **options):
  File "/Users/hugo/github/Pillow/src/PIL/ImageShow.py", line 77, in show
    return self.show_image(image, **options)
  File "/Users/hugo/github/Pillow/src/PIL/ImageShow.py", line 97, in show_image
    return self.show_file(self.save_image(image), **options)
  File "/Users/hugo/github/Pillow/src/PIL/ImageShow.py", line 136, in show_file
    f.write(file)
AttributeError: 'int' object has no attribute 'write'

What are your OS, Python and Pillow versions?

  • OS: macOS High Sierra
  • Python: 3.7.1 and 2.7.15
  • Pillow: master
from PIL import Image
im = Image.new("RGB", (200, 100))
im.show()

Cannot reproduce with last Pillow release 5.3.0.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions