From 54c68be7fd20b279aec540778b57e9a017571afa Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Tue, 27 Jan 2015 15:18:27 +0100 Subject: [PATCH] Don't crash when unable to unlink --- scanner/PhotoAlbum.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scanner/PhotoAlbum.py b/scanner/PhotoAlbum.py index 8e09554..437687e 100644 --- a/scanner/PhotoAlbum.py +++ b/scanner/PhotoAlbum.py @@ -262,11 +262,17 @@ class Photo(object): try: image.save(thumb_path, "JPEG", quality=88) except KeyboardInterrupt: - os.unlink(thumb_path) + try: + os.unlink(thumb_path) + except: + pass raise except: message("save failure", os.path.basename(thumb_path)) - os.unlink(thumb_path) + try: + os.unlink(thumb_path) + except: + pass def _thumbnails(self, image, thumb_path, original_path): mirror = image