import traceback

try:

  your code

except:

  traceback.print_exc()

相关文章: