My code is raising a custom exception which is putting my debugger in the wrong place. For example in the following code, I would like to print the value of my important_local_variable from the debugger, however it seems to be inaccessable as the debugger is starting inside the CustomException:
test.py
class CustomException(Exception):
pass
def my_func():
important_local_variable = 0
badness = 1/important_local_variable
try:
my_func()
except:
raise CustomException
python3 -m ipdb test.py
bash-3.2$ python3 -m pdb test.py
> /Users/max/test.py(1)<module>()
-> class CustomException(Exception):
(Pdb)
from Can you bring Python debugger back to the original exception during custom exception handling?
No comments:
Post a Comment