From 0a5c90ba98784192071fddbd82ec3ed7cc39bba2 Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Sun, 13 Nov 2011 11:23:49 -0500 Subject: [PATCH] delete a tile if the innertile routine can't open it This makes corrupt tiles self-correcting on subsequent runs. Before, the warning is printed but the tile remains. Worse, the warning won't be printed again. --- overviewer_core/quadtree.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/overviewer_core/quadtree.py b/overviewer_core/quadtree.py index 8624ba4..cd77fb8 100644 --- a/overviewer_core/quadtree.py +++ b/overviewer_core/quadtree.py @@ -338,7 +338,12 @@ class QuadtreeGen(object): quad = Image.open(path[1]).resize((192,192), Image.ANTIALIAS) img.paste(quad, path[0]) except Exception, e: - logging.warning("Couldn't open %s. It may be corrupt, you may need to delete it. %s", path[1], e) + logging.warning("Couldn't open %s. It may be corrupt. Error was '%s'", path[1], e) + logging.warning("I'm going to try and delete it. You will need to run the render again") + try: + os.unlink(path[1]) + except Exception, e: + logging.warning("I couldn't delete it. You will need to delete it yourself. Error was '%s'", e) # Save it if self.imgformat == 'jpg':