~ubuntu-branches/ubuntu/wily/python-imaging/wily

« back to all changes in this revision

Viewing changes to Tests/test_001_archive.py

  • Committer: Package Import Robot
  • Author(s): Matthias Klose
  • Date: 2013-01-31 20:49:20 UTC
  • mfrom: (27.1.1 raring-proposed)
  • Revision ID: package-import@ubuntu.com-20130131204920-b5zshy6vgfvdionl
Tags: 1.1.7+1.7.8-1ubuntu1
Rewrite build dependencies to allow cross builds.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import PIL
 
2
import PIL.Image
 
3
 
 
4
import glob, os
 
5
 
 
6
for file in glob.glob("../pil-archive/*"):
 
7
    f, e = os.path.splitext(file)
 
8
    if e in [".txt", ".ttf", ".otf", ".zip"]:
 
9
        continue
 
10
    try:
 
11
        im = PIL.Image.open(file)
 
12
        im.load()
 
13
    except IOError as v:
 
14
        print("-", "failed to open", file, "-", v)
 
15
    else:
 
16
        print("+", file, im.mode, im.size, im.format)
 
17
        if e == ".exif":
 
18
            try:
 
19
                info = im._getexif()
 
20
            except KeyError as v:
 
21
                print("-", "failed to get exif info from", file, "-", v)
 
22
 
 
23
print("ok")