close file properly and remove unneeded variable

This commit is contained in:
András Veres-Szentkirályi 2013-02-21 11:29:24 +01:00 committed by Joar Wandborg
parent 64376dc0bc
commit 9aff782ba7

View File

@ -73,16 +73,12 @@ def extract_exif(filename):
"""
Returns EXIF tags found in file at ``filename``
"""
exif_tags = {}
try:
image = open(filename)
exif_tags = process_file(image, details=False)
with file(filename) as image:
return process_file(image, details=False)
except IOError:
raise BadMediaFail(_('Could not read the image file.'))
return exif_tags
def clean_exif(exif):
'''