def wait_on_error():
"""\
Wait on exception, but only if console window was opened separately.
"""
if not is_separate_console_window():
return
import msvcrt
import traceback
def handle_exception(exctype, value, tb): # pylint: disable=invalid-name
"""Print an exception and wait for a key"""
traceback.print_exception(exctype, value, tb)
sys.stderr.flush()
sys.stdout.write('\n[Press any key]\n')
sys.stdout.flush()
msvcrt.getch()
sys.excepthook = handle_exception
评论列表
文章目录