def __init__(self, command_file, spool_dir):

        self.spool_dir = spool_dir
        # Create or cleanup the spool dir
        if os.path.isdir(spool_dir):
            self._cleanup_spool()
        else:
            assert not os.path.exists(spool_dir)
            try:
                os.makedirs(spool_dir)
            except OSError, ex:
                raise errors.InitError(
                        "Cannot create directory %s: %s" % (spool_dir, ex))

        info = os.stat(command_file)
        if not stat.S_ISFIFO(info.st_mode):
            raise errors.InitError(
                    "Command file %s is not a fifo" % command_file)

        self.writer = NagiosWriter(command_file)
Create writer and add it to the reactor.
dataset/ETHPy150Open marineam/nagcat/python/nagcat/nagios_api.py/NagiosCommander.__init__