Sunday, February 13, 2011

Is there any way to get a REPL in pydev?

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?

  • 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.

    From nosklo
  • 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

0 comments:

Post a Comment