e = 'before' try: x = int('cat') except Exception as e: e2 = e print(e) print(e2) # <- This works! print(e) # <- NameError: name 'e' is not defined