From 6637d499e773ada6d0f9707227b5622ff07b2d32 Mon Sep 17 00:00:00 2001 From: mcara Date: Wed, 4 Jun 2014 04:42:25 +0000 Subject: deleteWCS crashes when called on compressed FITS HDU (CompImageHDU) because of a bug in CompImageHDU that does not allow `del` on non-existent header keywords. For more details see https://github.com/astropy/astropy/issues/2594 git-svn-id: http://svn.stsci.edu/svn/ssb/stsci_python/stwcs/trunk@32334 fe389314-cf27-0410-b35b-8c050e845b92 --- lib/stwcs/wcsutil/altwcs.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'lib/stwcs/wcsutil') diff --git a/lib/stwcs/wcsutil/altwcs.py b/lib/stwcs/wcsutil/altwcs.py index befa2bb..bdb9b3b 100644 --- a/lib/stwcs/wcsutil/altwcs.py +++ b/lib/stwcs/wcsutil/altwcs.py @@ -350,7 +350,8 @@ def deleteWCS(fname, ext, wcskey=" ", wcsname=" "): if hwcs is None: continue for k in hwcs.keys(): - del hdr[k] + if k in hdr: + del hdr[k] #del hdr['ORIENT'+wkey] prexts.append(i) if prexts != []: -- cgit