rebaseline_server: delete invalid image files from local disk cache
authorcommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 26 Mar 2014 13:38:29 +0000 (13:38 +0000)
committercommit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81>
Wed, 26 Mar 2014 13:38:29 +0000 (13:38 +0000)
BUG=skia:2247
NOTREECHECKS=True
NOTRY=True
R=borenet@google.com

Author: epoger@google.com

Review URL: https://codereview.chromium.org/211733004

git-svn-id: http://skia.googlecode.com/svn/trunk@13951 2bbb7eff-a529-9590-31e7-b0007b416f81

gm/rebaseline_server/imagediffdb.py

index a53eb1f..8328543 100644 (file)
@@ -387,7 +387,10 @@ def _open_image(filepath):
   try:
     return Image.open(filepath)
   except IOError:
-    logging.error('IOError loading image file %s' % filepath)
+    # If we are unable to load an image from the file, delete it from disk
+    # and we will try to fetch it again next time.  Fixes http://skbug.com/2247
+    logging.error('IOError loading image file %s ; deleting it.' % filepath)
+    os.remove(filepath)
     raise