Closed sorasful closed 2 years ago
py-spy dump --locals
displays the local variables of each frame. The thing is, a variable defined in the module level is not a variable of any frame - it's a global variable. (which py-spy can theoretically print but it's just to implemented to do so at the moment).
If the code was written this way:
import getpass
import time
def main():
pwd = getpass.getpass()
while True:
time.sleep(1)
main()
you'd achieve your goal :)
Oh okay, I get it ! Thank you for your answer, I close this :)
Hello there,
I have a fairly simple code, I want to be able to access the
pwd
variable. I've tried usingdump
with--locals
options, but it did not show me the variables.The result : I can see where I am in the code, but not the values of the variable.
Thanks for your help !