# $Header: https://oberon.oapd.inaf.it/shins/trunk/shins/src/data_mgr/print_FITS.py 3277 2020-06-26 13:45:06Z depa $

"""Script executed by C++ printFITS ICE method
expects:
fitsFilename: file were to add the FITS keyword
listFITSKewords: list of tuple with values for FITS keyword"""

from astropy.io import fits
from util import shinsLogger
import sys

try:
    with fits.open(filenameSHINS, mode="update") as hdulOrig:
        hdulOrig[0].header.extend(cards=listFITSKewords, bottom=True)
        hdulOrig.flush()
    status = 0

except IOError as e:
    print ("ERROR")
    status = 1
    raise e
