python pudb stops stepping when main() is called

29 views Asked by At

I'm very new to using pudb, i've just been using print statements forever to do basic debugging on my py code.

As soon as it enters my main() function it exits and goes to my bash prompt. How do you follow the execution all the way through the program?

Thanks!

1

There are 1 answers

0
Jan Vlcinsky On BEST ANSWER

There are multiple types of commands in debuger.

You are likely to use "n" for Next. This never dives into inner functions and just keeps stepping on the existing level.

You shall use "s" for "Step into". Just do it few times and you will get into it.

Tested on following code and it works:

def main():
    a = 1
    b = 2
    c = a + b
    print("total", a + b + c)

if __name__ == "__main__":
    main()

Running:

$ pudb main.py

and pressing "s" 5 times, I get into line b = 2 and see in variable windows that a has value of 1.