Pillow image.getexif() fails in Flatpak

Viewed 44

This works perfectly when run as a Python program, but as a Flatpak it always fails on image.getexif().

The Python has:

from PIL import Image, ExifTags, ImageOps 
from PIL.ExifTags import TAGS

if os.path.isfile(myfile):
    image = Image.open(myfile)
else:       
    return -2
try:
    image_exif = image.getexif()
except:
    test = 'image_exif failed'

The Flatpak has:

  - name: python3-pillow
    buildsystem: simple
    build-commands:
      - pip3 install --no-index --find-links="file://${PWD}" --prefix=${FLATPAK_DEST} Pillow
    sources:
      - type: file
        url: https://files.pythonhosted.org/packages/3c/7e/443be24431324bd34d22dd9d11cc845d995bcd3b500676bcf23142756975/Pillow-5.4.1.tar.gz
        sha256: 5233664eadfa342c639b9b9977190d64ad7aca4edc51a966394d7e08e7f38a9f

Is it likely to be the Pillow version? Python on my PC is 8.3.2, but the Flatpak gets 5.4.1.

1 Answers

I added this to the program

from PIL import __version__

then

Print(__version__)

I removed the error trapping, then instead of running the Flatpak from a menu, I ran it from a terminal. That showed the Pillow version and the error. The Pillow version on my computer was 8.3.2 and that in the Flatpak was only 5.4.1. The function I had added to my program was obviously different or missing from the earlier version. Updating the Pillow version in the Flatpak fixed the problem.

Related