-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Closed
Labels
Description
The viewer is opened, but a "No images found" error is displayed. Pillow version pillow-9.0.0. This may be the same bug: https://stackoverflow.com/questions/63579415/why-does-pil-fail-to-display-images-with-error-no-images-found-in-file-tmp
Code to reproduce:
from PIL import Image
im = Image.open(r"/var/lib/app-info/icons/ubuntu-focal-updates-universe/48x48/inkscape_inkscape.png")
im.show()Changing the code in the UnixViewer class in ImageShow.py seems to fix it. I'm not sure why the current code is writing the filename to a file and then reading it back from stdin, using shell=True in Popen. Deleting the rm -f $im" command in the Popen call seems to fix the problem. It also seems to work using cat | xargs -L1 in the Popen command instead of setting the shell variable im.
This simpler code replacement also seems to work, without setting shell=True:
def show_file(self, file, **options):
"""Display given file"""
command = self.get_command_ex(file, **options)[0]
subprocess.Popen([command, file])
return 1