See [docs here](https://docs.python.org/3/library/traceback.html). Note that `sys.exception()`, within an `except`, returns the current exception. ```python import traceback from datetime import datetime try: open("does_not_exist") except Exception as e: traceback.print_exc() with open("exc.txt","at") as f: print(f"==[ {datetime.now().strftime('%c')} ]==",file=f) traceback.print_exc(file=f) ```