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`` Returns EXIF tags found in file at ``filename``
""" """
exif_tags = {}
try: try:
image = open(filename) with file(filename) as image:
exif_tags = process_file(image, details=False) return process_file(image, details=False)
except IOError: except IOError:
raise BadMediaFail(_('Could not read the image file.')) raise BadMediaFail(_('Could not read the image file.'))
return exif_tags
def clean_exif(exif): def clean_exif(exif):
''' '''