Python Forum

Full Version: how to get a traceback and keep on running?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
how to get a traceback and keep on running? i'd like to know because it can sometimes be useful. plus, it happened on its own with code i was working on, today. i forgot to save that output and where it happened would be nice to find. it has happened a couple times in the past, so i know something can do it.
import traceback

items = {}

try:
    items["NoKey"]
except KeyError:
    format_exc = traceback.format_exc()

print("Keep running")
print(format_exc)