We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 39325d6 commit 25c039aCopy full SHA for 25c039a
pslab/external/display.py
@@ -16,7 +16,12 @@
16
import json
17
import os.path
18
19
-from PIL import Image
+try:
20
+ from PIL import Image
21
+
22
+ HASPIL = True
23
+except ImportError:
24
+ HASPIL = False
25
26
from pslab.bus import I2CSlave
27
@@ -415,6 +420,11 @@ def display(self, image: Image):
415
420
image : Image
416
421
A PIL.Image instance.
417
422
"""
423
+ if not HASPIL:
424
+ raise ImportError(
425
+ "Displaying images requires PIL, but it is not installed."
426
+ )
427
418
428
if not image.size == (128, 64):
419
429
image = image.resize((128, 64))
430
0 commit comments