调试 PyDev+Eclipse - 在断点/挂起模式下更改代码后代码不会重新加载
我经常执行这样的步骤,并希望优化调试速度:
- 我正在设置一些断点。
- 我正在运行 Google Appengine 应用程序(Python 2.5.2+)。
- 当断点发生时,我经常更改代码来修复错误。
- 代码更改后想要再次测试,但如果我在断点/挂起模式下更改代码,则会出现问题,应用程序不会随着我的代码更改更新 - 因此需要缓慢重新加载。
有谁知道暂停后强制重新加载的根本原因是什么,或者是 PyDev 错误/限制?
I often doing such steps and want to optimize debug speed:
- I am setting some breakpoints.
- I am running Google Appengine Application (Python 2.5.2+).
- When breakpoint occur I often change code to fix bugs.
- After code change want to test again but there is problem if I changed code in breakpoint/suspend mode the application does not updates with my code changes - thus requiring a slow reloading.
Does anybody have an idea of what is root cause of forcing reloading after suspend or it is PyDev Bug/Limitation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
调试的工作方式不是逐行执行源。 调试将您的源代码“编译”为字节码(.pyc 文件)并执行这些字节码,而不是您的源代码。
调试仅跟踪 .pyc 文件的哪一部分对应于 .py 文件的哪一行,并显示该信息以方便您使用,但 .py 文件本身并不是调试器用来运行程序的内容。
因此,如果更改源/.py 文件并希望调试器确认这些更改,则需要首先“重新编译”.pyc 文件。
哈!
The way the debug works is not by executing the source line-by-line. The debug "compiles" your source to bytecode (the .pyc files) and execute those, not your source.
The debug only keeps track of what piece of the .pyc files correspond to what line of your .py ones and display that information for your convenience, but the .py file itself is not what the debugger is using to run the program.
Therefore, if you change the source / .py file and want the debugger to acknowledge those changes, you need to "recompile" the .pyc files first.
HTH!