script.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:ldap2pg 作者: dalibo 项目源码 文件源码
def main():
    debug = os.environ.get('DEBUG', '').lower() in ('1', 'y')
    verbose = os.environ.get('VERBOSE', '').lower() in ('1', 'y')

    config = Configuration()
    config['debug'] = debug
    config['verbose'] = debug or verbose
    config['color'] = sys.stderr.isatty()
    dictConfig(config.logging_dict())
    logger.debug("Debug mode enabled.")

    try:
        exit(wrapped_main(config))
    except pdb.bdb.BdbQuit:
        logger.info("Graceful exit from debugger.")
    except UserError as e:
        logger.critical("%s", e)
        exit(e.exit_code)
    except Exception:
        logger.exception('Unhandled error:')
        if debug and sys.stdout.isatty():
            logger.debug("Dropping in debugger.")
            pdb.post_mortem(sys.exc_info()[2])
        else:
            logger.error(
                "Please file an issue at "
                "https://github.com/dalibo/ldap2pg/issues with full log.",
            )
    exit(os.EX_SOFTWARE)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号