views:

268

answers:

2

I would like to be able to drop to the python REPL from the debugger -- if this is not possible is there an easier way to evaluate python expressions in the context of the current breakpoint other than manually adding them all as watch expressions?

+4  A: 

I don't use pydev, but to drop to python's interactive REPL from code:

import code
code.interact(local=locals())

To drop to python's debugger from code:

import pdb
pdb.set_trace()

Finally, to run a interactive REPL after running some code, you can use python's -i switch:

python -i script.py

That will give you a python prompt after the code, even if it throws an exception.

You may be able to hook some of those solutions into pydev, I think.

nosklo
+1  A: 

There is a dedicated Pydev Console available by clicking on the "New console" dropdown in the console view.

See http://pydev.sourceforge.net/console.html

Dag Høidahl