Search code examples
pythoneclipsedebuggingbreakpointspydev

Jump into a Python Interactive Session mid-program?


Hey I was wondering... I am using the pydev with eclipse and I'm really enjoying the powerful debugging features, but I was wondering:

Is it possible to set a breakpoint in eclipse and jump into the interactive python interpreter during execution?

I think that would be pretty handy ;)

edit: I want to emphasize that my goal is not to jump into a debugger. pydev/eclipse have a great debugger, and I can just look at the traceback and set break points.

What I want is to execute a script and jump into an interactive python interpreter during execution so I can do things like...

  • poke around
  • check the values of things
  • manipulate variables
  • figure out some code before I add it to the app

I know you can do this all with a debugger, but I can do it faster in the interactive interpreter because I can try something, see that it didn't work, and try something else without having get the app back to the point of executing that code again.


Solution

  • So roughly a year on from the OP's question, PyDev has this capability built in. I am not sure when this feature was introduced, but all I know is I've spent the last ~2hrs Googling... configuring iPython and whatever (which was looking like it would have done the job), but only to realise Eclipse/PyDev has what I want ootb.

    As soon as you hit a breakpoint in debug mode, the console is right there ready and waiting! I only didn't notice this as there is no prompt or blinking cursor; I had wrongly assumed it was a standard, output-only, console... but it's not. It even has code-completion.

    Great stuff, see http://pydev.org/manual_adv_debug_console.html for more details.