Commits

Christian Tismer committed 549a5f4

guy is broken now...

  • Participants
  • Parent commits 0dc735e

Comments (0)

Files changed (1)

File playground/piltest.py

 import sys, os
-import Image
-
 from ddc import rootpath
 
-imfile = os.path.join(rootpath, 'ddc/tool/test/data/Image000.TIF')
+from warnings import warn
 
-im = Image.open(imfile)
-im.seek(1)
+def check_pil(warning=True):
+    try:
+        import Image
+    except ImportError:
+        if warning:
+            warn('PIL is not installed')
+        return False
 
-im.save('look.tiff')
+    imfile = os.path.join(rootpath, 'ddc/config/data/demo-g4-2pages.tiff')
+    im = Image.open(imfile)
+    im.seek(1)
+    try:
+        im.load()
+    except IOError:
+        if warning:
+            warn('CCITT G4 support is not compiled/working')
+        return False
+    return True
+
+if __name__ == '__main__':
+    check_pil()