summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorembray <embray@stsci.edu>2012-02-24 10:37:41 -0500
committerembray <embray@stsci.edu>2012-02-24 10:37:41 -0500
commitbccc58b04ccf675177a94d7042e78413cf1c1586 (patch)
tree3d58d980de2c67996774fcf59a294c624ff32ca3
parenteea84c4ba8571b0c34b20a90fde3e2f5fb8260ce (diff)
downloadstwcs_hcf-bccc58b04ccf675177a94d7042e78413cf1c1586.tar.gz
Don't assume that there are definitely any HISTORY cards.
git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stsci_python/trunk/stwcs@15285 fe389314-cf27-0410-b35b-8c050e845b92
-rw-r--r--lib/stwcs/wcsutil/headerlet.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/stwcs/wcsutil/headerlet.py b/lib/stwcs/wcsutil/headerlet.py
index 6d3be64..c4bfa22 100644
--- a/lib/stwcs/wcsutil/headerlet.py
+++ b/lib/stwcs/wcsutil/headerlet.py
@@ -1835,8 +1835,9 @@ class Headerlet(pyfits.HDUList):
self.fit_kws = ['HDRNAME', 'NMATCH', 'CATALOG']
self.history = ''
# header['HISTORY'] returns an iterable of all HISTORY values
- for hist in self[0].header['HISTORY']:
- self.history += hist + '\n'
+ if 'HISTORY' in self[0].header:
+ for hist in self[0].header['HISTORY']:
+ self.history += hist + '\n'
self.d2imerr = 0
self.axiscorr = 1