How can I interact with fairly long python scripts?

I like IDLE. However, sometimes I have scripts on 100-200 lines, and I want to sort interactively debug / play, say, the functions defined in foo.py, and not just a call python foo.py. Is there a way I can call IDLE in my context foo.py?

+3
source share
2 answers

Insert this line in the script:

import pdb; pdb.set_trace()

Which will launch the python debugger , which allows you to interactively go through the script by checking the variables and for example you go.

+5
source

I assume you are asking how to enable standby debugging?

Python Shell Debugger Debug, foo.py Run Model. Debug Control, foo.py; , - , , ( script).

+1

Source: https://habr.com/ru/post/1735899/


All Articles