Skip to content

Commit

Permalink
Merge pull request #130 from lsst-camera-dh/u/jchiang/image_utils_fit…
Browse files Browse the repository at this point in the history
…s_resource_fix

use fits.open context to avoid unclosed file
  • Loading branch information
jchiang87 authored Jan 5, 2021
2 parents a00926a + 222ebda commit e0d0876
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion python/lsst/eotest/image_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ def __init__(self, infile, hdu=0):
except:
# This exception occurs when DM stack encounters a "." in
# a FITS header keyword.
self.header = fits.open(infile)[hdu].header
with fits.open(infile) as hdulist:
self.header = dict()
self.header.update(hdulist[hdu].header)

def get(self, key):
return self(key)
Expand Down

0 comments on commit e0d0876

Please sign in to comment.