for unit=u.Unit('nanomaggy'), the line fits.py:170 dsthdr['BUNIT'] = (unit.to_string('fits'), 'data unit type') failes inside a try/except. fix is replacing line fits.py:171 by except: instead of except u.format.fits.UnitScaleError: