Skip to content

Commit e0d0876

Browse files
authored
Merge pull request #130 from lsst-camera-dh/u/jchiang/image_utils_fits_resource_fix
use fits.open context to avoid unclosed file
2 parents a00926a + 222ebda commit e0d0876

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

python/lsst/eotest/image_utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ def __init__(self, infile, hdu=0):
2626
except:
2727
# This exception occurs when DM stack encounters a "." in
2828
# a FITS header keyword.
29-
self.header = fits.open(infile)[hdu].header
29+
with fits.open(infile) as hdulist:
30+
self.header = dict()
31+
self.header.update(hdulist[hdu].header)
3032

3133
def get(self, key):
3234
return self(key)

0 commit comments

Comments
 (0)