Mercurial > hg > montage
changeset 13:ca43a7f71985
remove badly created files, for now
| author | k0s <k0scist@gmail.com> | 
|---|---|
| date | Fri, 25 Dec 2009 22:21:10 -0500 | 
| parents | e9be444c874b | 
| children | 6a33dc59e4a6 | 
| files | montage/formatters.py | 
| diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] | 
line wrap: on
 line diff
--- 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):
