0

re-render a chunk if the image is corrupt

This commit is contained in:
Andrew Brown
2010-09-02 23:19:15 -04:00
parent 0b2880de08
commit d86f158b9f

View File

@@ -103,7 +103,16 @@ class ChunkRenderer(object):
dest_path = os.path.join(destdir, dest_filename)
if os.path.exists(dest_path):
return dest_path
# Try to open it to see if it's corrupt or something (can happen if
# the program crashed last time)
try:
testimg = Image.open(dest_path)
testimg.load()
except Exception:
# guess not, continue below
pass
else:
return dest_path
else:
# Remove old images for this chunk
for oldimg in os.listdir(destdir):