def main():
    (opts, args) = getopts()
    if chkopts(opts) is True:
        return PROCERROR
    
    cf = readconf(opts.config)
    if cf is None:
        print >>sys.stderr, 'Failed to load the config file "%s". (%s)' % (opts.config, sys.argv[0])
        return PROCERROR

    # conf parse
    if parse_conf(cf) is False:
        return PROCERROR

    # set env=PYSILHOUETTE_CONF
    os.environ['PYSILHOUETTE_CONF'] = opts.config
    
    if reload_conf(cf["env.sys.log.conf.path"]):
        logger = logging.getLogger('pysilhouette.asynperformer')
    else:
        print >>sys.stderr, 'Failed to load the log file. (%s)' % sys.argv[0]
        return PROCERROR

    try:
        try:
            signal.signal(signal.SIGTERM, sigterm_handler)
            asynperformer = AsynPerformer(opts, cf)
            ret = asynperformer.process() # start!!
            return ret
        except __HOLE__, k:
            logger.critical('Keyboard interrupt occurred. - %s' % str(k.args))
            print >>sys.stderr, 'Keyboard interrupt occurred. - %s' % str(k.args)
        except Exception, e:
            logger.critical('System error has occurred. - %s' % str(e.args))
            print >>sys.stderr, 'System error has occurred. - %s' % str(e.args)
            print >>sys.stderr, traceback.format_exc()
            t_logger = logging.getLogger('pysilhouette_traceback')
            t_logger.critical(traceback.format_exc())
            
    finally:
        if opts.daemon is True and os.path.isfile(opts.pidfile):
            os.unlink(opts.pidfile)
            logger.info('Process file has been deleted.. - pidfile=%s' % opts.pidfile)

    return PROCERROR
dataset/ETHPy150Open karesansui/pysilhouette/pysilhouette/asynperformer.py/main