Commits

J.A. Roberts Tunney  committed 9c4af8e

better pil checking

  • Participants
  • Parent commits 208dc7d

Comments (0)

Files changed (2)

File fabulous/image.py

 
 import sys
 import itertools
+import textwrap
 
-from PIL import Image as Pills
+try:
+    from PIL import Image as Pills
+except ImportError:
+    raise ImportError(textwrap.dedent("""
+        I'm sorry, I can't render images without PIL :'(
+
+        Ubuntu Users: sudo apt-get install python-imaging
+
+        Windows Users: The PIL people should have something easy to
+          install that you can download from their website.
+
+        Everyone Else: This is like the hardest library in the world
+          to manually install.  If your package manager doesn't have
+          it, you can try running ``sudo easy_install pil`` once you
+          get your hands on a C compiler the development headers for
+          ``python``, ``libz``, ``libjpeg``, ``libgif``, ``libpng``,
+          ``libungif4``, ``libfreetype6``, and maybe more >_>
+        """]))
 from grapefruit import Color
 
 from fabulous import utils, xterm256

File fabulous/text.py

 
 import os
-
 import grapefruit
+# let image module do its pil check thing first
+from fabulous import image, color
 from PIL import Image, ImageFont, ImageDraw
 
-from fabulous import image, color
-
 
 DEFAULT_FONT = os.path.join(os.path.dirname(__file__), 'fonts', 'IndUni-H-Bold.otf')