# HG changeset patch # User k0s # Date 1261797670 18000 # Node ID ca43a7f719859e84bfd38bd7e8b88b4d04c7784f # Parent e9be444c874bfceb784831079802048a66d57dd7 remove badly created files, for now diff -r e9be444c874b -r ca43a7f71985 montage/formatters.py --- a/montage/formatters.py Fri Dec 25 19:35:46 2009 -0500 +++ b/montage/formatters.py Fri Dec 25 22:21:10 2009 -0500 @@ -83,15 +83,20 @@ if create_thumbnail: # do thumbnail creation + flag = False try: image = Image.open(filepath) thumbnail_image = crop_resize(image, (self.width, self.height)) fd = file(thumbnail_file, 'w') + flag = True thumbnail_image.save(fd) fd.close() - except: # failure to create thumbnail - pass + except Exception, e: # failure to create thumbnail + # cleanup file + if flag: + fd.close() + os.remove(thumbnail_file) # fix the path to point to the thumbnail if os.path.exists(thumbnail_file):