Question

All,

Is there an IDE that makes it possible to develop python code in debug mode?

What I mean is that I would like to possibility to run a program to a breakpoint and then develop code in the console. In this way I would like to try/test code in the console and then copy correct parts from the console to the editor.

Developing R code in this way using Eclipse/Statet is a very fast/agile experience compared to the cycle of writing code, debugging, analyzing the error, changing code and moving on to the next bug (possibly on the next line).

So far I've looked at Eclipse/pydev and pycharm but as far as I know they only support the evaluation of one single statement. More specific it is not possible to change the state of the program being debugged using console statements (for example declare new variables)

Was it helpful?

Solution

Run your python code with the flag -i to drop into an interactive session automatically at the end of program execution, with all objects still intact:

$ python -i script.py
[output]
>>> 

You can also add a breakpoint to your script using pdb.set_trace():

pdb.set_trace()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top