Interactive console using Pydev in Eclipse?

随声附和 提交于 2019-11-28 17:05:10

问题


I'm debugging my Python code in Eclipse using the Pydev plugin. I'm able to open a Pydev console and it gives me two options: "Console for currently active editor" and "Python console". However none of them is useful to inspect current variable status after a breakpoint.

For example, the code stopped at a breakpoint and I want to inspect an "action" variable using the console. However my variables are not available. How can I do things like "dir(action)", etc? (even if it is not using a console).


回答1:


This feature is documented here:

http://pydev.org/manual_adv_debug_console.html




回答2:


The console that opens in the debug perspective is in fact interactive, although it took me a while to realize it. You need to hit return twice after typing something and then it gets evaluated. More info on the Pydev site here: http://pydev.org/manual_adv_debug_console.html




回答3:


Double click on "action" or any other variable.

ctrl+shift+D

And if you're using watches, I cant imagine better interaction. You are able to see every change.




回答4:


When I set a break point and hit F11 Eclipse launches the debugger and prompts to open the "Debug Perspective". You can then open the Window-->Show View --> Expressions which opens the expressions view, you can then right click in the Expressions view windows and choose "Add Watch Expression" to add any expression(such as dir) Conversely I was also able to type in dir(some expression) in the PyDev console and get the same effect. I'm using PyDev 1.4.6.2788




回答5:


On a small monitor, you may not realize that the debug interactive console is different from the regular interactive console: it has a second command prompt at the bottom where you type, not at the top like the normal console.



来源:https://stackoverflow.com/questions/271625/interactive-console-using-pydev-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!