Commit 088db024 authored by Leo Pound Singer's avatar Leo Pound Singer

Work around lack of clobber= support in old versions of Table.write

Original: 9b2367ae6492d919fadd046ef377e01fec8d6772
parent 50ce773d
......@@ -348,6 +348,15 @@ def rename(src, dst):
def rm_f(filename):
"""Remove a file, or be silent if the file does not exist, like `rm -f`."""
except OSError as e:
if e.errno != errno.ENOENT:
def register_to_xmldoc(xmldoc, parser, opts, **kwargs):
from glue.ligolw.utils import process
return process.register_to_xmldoc(
......@@ -60,6 +60,7 @@ __author__ = "Leo Singer <>"
__all__ = ("read_sky_map", "write_sky_map")
import os
import math
import healpy as hp
import numpy as np
......@@ -364,6 +365,12 @@ def write_sky_map(filename, m, **kwargs):
# Scientific Linux 7 computing clusters.
except AttributeError:
# FIXME: With some old versions of astropy that we still have to
# support, the astropy.table.Table.write method did not support the
# clobber argument. So we have to manually delete the file first so
# that does not complain that the file exists.
from ..bayestar.command import rm_f
m.write(filename, format='fits')
hdulist =
_, hdu = hdulist
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment