summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/stwcs/wcsutil/altwcs.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/stwcs/wcsutil/altwcs.py b/lib/stwcs/wcsutil/altwcs.py
index 7099898..e4ca488 100644
--- a/lib/stwcs/wcsutil/altwcs.py
+++ b/lib/stwcs/wcsutil/altwcs.py
@@ -68,7 +68,10 @@ def archiveWCS(fname, ext, wcskey=" ", wcsname=" ", reusekey=False):
raise KeyError("Either wcskey or wcsname should be specified")
if wcsname.strip() == "":
- wcsname = readAltWCS(f, ext[0], wcskey=" ")['WCSNAME']
+ try:
+ wcsname = readAltWCS(f, ext[0], wcskey=" ")['WCSNAME']
+ except KeyError:
+ pass
wcsext = ext[0]
if wcskey != " " and wcskey in wcskeys(f[wcsext].header) and not reusekey:
closefobj(fname, f)