跳入Python交互式会话中期程序? [英] Jump into a Python Interactive Session mid-program?

查看:120
本文介绍了跳入Python交互式会话中期程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我在想...我正在使用pydev与eclipse,我真的很享受强大的调试功能,但我想知道: >是否可以在eclipse中设置断点,并在执行期间跳转到交互式python解释器?



我认为这将是非常方便的) p>

编辑:我想强调,我的目标不是跳入调试器。 pydev / eclipse有一个很好的调试器,我可以看看追溯并设置断点。



我想要的是执行一个脚本并跳入一个交互式python解释器在执行期间,所以我可以做的事情,如...




  • poke around

  • 检查值的东西

  • 操纵变量

  • 在将其添加到应用程序之前,找出一些代码



我知道你可以用调试器完成所有这些,但是我可以在交互式解释器中更快地做到这一点,因为我可以尝试一些东西,看到它没有起作用,没有让应用程序再次执行该代码。

解决方案

从OP的问题大概一年,PyDev有这个功能内置。我不知道这个功能是什么时候介绍的,但我知道的是我花了最后〜2小时的谷歌...配置iPython和任何(看起来像它将完成这项工作),但只能实现Eclipse / PyDev具有我想要的ootb。



一旦在调试模式下点击断点,控制台就是就在那里准备好等待!
我没有注意到,因为没有提示或闪烁的光标;我错误地认为它是一个标准的,仅输出的控制台,但不是。它甚至有代码完成。



很棒的东西,请参见 http ://pydev.org/manual_adv_debug_console.html 了解更多详情。


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.

解决方案

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.

这篇关于跳入Python交互式会话中期程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆