slipsomat.py 文件源码

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

项目:alma-slipsomat 作者: scriptotek 项目源码 文件源码
def handle_exception(self, e):
        print("\nException:", e)
        traceback.print_exc(file=sys.stdout)

        if inquirer is None:
            print('Please "pip install inquirer" if you would like more debug options')
            sys.exit(0)
        else:
            q = inquirer.List('goto',
                              message='Now what?',
                              choices=['Restart browser', 'Debug with ipdb', 'Debug with pdb', 'Exit'],
                              )
            answers = inquirer.prompt([q])

            if answers['goto'] == 'Debug with ipdb':
                try:
                    import ipdb
                except ImportError:
                    print('Please run "pip install ipdb" to install ipdb')
                    sys.exit(1)
                ipdb.post_mortem()
                sys.exit(0)
            elif answers['goto'] == 'Debug with pdb':
                import pdb
                pdb.post_mortem()
                sys.exit(0)
            elif answers['goto'] == 'Restart browser':
                self.browser.restart()
            else:
                sys.exit(0)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号