chiark / gitweb /
m.images: don't fail if Pillow is not available.
authorVladimír Vondruš <mosra@centrum.cz>
Mon, 11 Sep 2017 15:16:52 +0000 (17:16 +0200)
committerVladimír Vondruš <mosra@centrum.cz>
Thu, 14 Sep 2017 22:11:11 +0000 (00:11 +0200)
It should be possible to use the plugin even w/o Pillow (but then image
grid won't work).

pelican-plugins/m/images.py

index b5cf23a4b42defaedf0deaa93d52c5c8c50b0bbf..cd363ab42d701ebf0d8a80b64bce6f40e7b1ddc5 100644 (file)
@@ -7,8 +7,14 @@ from docutils.parsers.rst.roles import set_classes
 from docutils import nodes
 from pelican import signals
 from pelican import StaticGenerator
-import PIL.Image
-import PIL.ExifTags
+
+# If Pillow is not available, it's not an error unless one uses the image grid
+# functionality
+try:
+    import PIL.Image
+    import PIL.ExifTags
+except ImportError:
+    PIL = None
 
 settings = {}