def do_overwrite_save(fs, path, data):

    def copy_data(path_dest):
        try:
            fs.create(path_dest, overwrite=False, data=data)
            logging.info("Wrote to " + path_dest)
        except Exception, e:
            # An error occurred in writing, we should clean up
            # the tmp file if it exists, before re-raising
            try:
                fs.remove(path_dest, skip_trash=True)
            except:
                logger.exception('failed to remove %s' % path_dest)
            raise e

    _do_overwrite(fs, path, copy_data)
dataset/ETHPy150Open cloudera/hue/desktop/libs/hadoop/src/hadoop/fs/fsutils.py/do_overwrite_save/original