12 April 2022

How to debug or test python scripts using inspect module and print and input?

At the top of your script, 
from inspect import currentframe, getframeinfo
At the spot where you want to print the value of a variable,
print(f'Line #{getframeinfo(currentframe()).lineno}:\nDescription:\n{varName}\nEnd of Description\n')
input()

No comments:

Post a Comment