Ver código fonte

images2gif: PILLOW_VERSION is obsolete (#899)

Relates to #827.
Anna Petrasova 4 anos atrás
pai
commit
2371cb8ec9
1 arquivos alterados com 3 adições e 3 exclusões
  1. 3 3
      lib/python/imaging/images2gif.py

+ 3 - 3
lib/python/imaging/images2gif.py

@@ -73,8 +73,8 @@ try:
     from PIL import Image
     from PIL import Image
     pillow = True
     pillow = True
     try:
     try:
-        from PIL import PILLOW_VERSION  # test if user has Pillow or PIL
-    except ImportError:
+        PIL.__version__  # test if user has Pillow or PIL
+    except AttributeError:
         pillow = False
         pillow = False
     from PIL.GifImagePlugin import getheader, getdata
     from PIL.GifImagePlugin import getheader, getdata
 except ImportError:
 except ImportError:
@@ -494,7 +494,7 @@ def writeGif(filename, images, duration=0.1, repeat=True, **kwargs):
     """
     """
     if pillow:
     if pillow:
         # Pillow >= 3.4.0 has animated GIF writing
         # Pillow >= 3.4.0 has animated GIF writing
-        version = [int(i) for i in PILLOW_VERSION.split('.')]
+        version = [int(i) for i in PIL.__version__.split('.')]
         if version[0] > 3 or (version[0] == 3 and version[1] >= 4):
         if version[0] > 3 or (version[0] == 3 and version[1] >= 4):
             writeGifPillow(filename, images, duration, repeat)
             writeGifPillow(filename, images, duration, repeat)
             return
             return