2017年4月27日 星期四

Python traceback

import traceback

def ToTraceLines(ex, ex_traceback=None):
    if ex_traceback is None:
        ex_traceback = ex.__traceback__
    return [ line.rstrip('\n') for line in traceback.format_exception(ex.__class__, ex, ex_traceback)]
   
try:
    x = get_number()
except Exception as ex:
    ToTraceLines(ex)

沒有留言:

張貼留言

2023 Promox on Morefine N6000 16GB 512GB

2023 Promox on Morefine N6000 16GB 512GB Software Etcher 100MB (not but can be rufus-4.3.exe 1.4MB) Proxmox VE 7.4 ISO Installer (1st ISO re...