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)
评论列表
文章目录