我把这个贴在程序员.stackexchange.com https://softwareengineering.stackexchange.com/questions/29844/emacs-methods-for-debugging-python,但我认为这可能更适合SO。
我使用 emacs 来满足所有代码编辑需求。通常,我会使用 M-x 编译来运行我的测试运行程序,我想说,这让我完成了保持代码正常运行所需的大约 70%,但最近我一直想知道如何在上使用 M-x pdb在某些情况下,最好设置一个断点并检查一些东西。
在我的谷歌搜索中我发现有些事情 http://twistedmatrix.com/documents/10.1.0/core/howto/debug-with-emacs.html这表明这是有用的/可能的。然而,我还没有设法让它以我完全理解的方式工作。
我不知道构建+应用程序引擎的组合是否会使其变得更加困难,但是当我尝试做类似的事情时
M-x pdb
Run pdb (like this): /Users/twillis/projects/hydrant/bin/python /Users/twillis/bin/pdb /Users/twillis/projects/hydrant/bin/devappserver /Users/twillis/projects/hydrant/parts/hydrant-app/
其中 .../bin/python 是解释器构建,为所有鸡蛋设置了路径。
~/bin/pdb 是一个使用当前 python 解释器调用 pdb.main 的简单脚本
HellooKitty:hydrant twillis$ cat ~/bin/pdb
#! /usr/bin/env python
if __name__ == "__main__":
import sys
sys.version_info
import pdb
pdb.main()
HellooKitty:hydrant twillis$
.../bin/devappserver 是构建配方为 gae 项目制作的 dev_appserver 脚本,.../parts/Hydrant-app 是 app.yaml 的路径
我首先看到一个提示
Current directory is /Users/twillis/bin/
C-c C-f
什么也没发生但是
HellooKitty:hydrant twillis$ ps aux | grep pdb
twillis 469 100.0 1.6 168488 67188 s002 Rs+ 1:03PM 0:52.19 /usr/local/bin/python2.5 /Users/twillis/projects/hydrant/bin/python /Users/twillis/bin/pdb /Users/twillis/projects/hydrant/bin/devappserver /Users/twillis/projects/hydrant/parts/hydrant-app/
twillis 477 0.0 0.0 2435120 420 s000 R+ 1:05PM 0:00.00 grep pdb
HellooKitty:hydrant twillis$
有事正在发生
C-x [space]
将报告已设置断点。但我无法让事情继续下去。
感觉就像我在这里遗漏了一些明显的东西。我是吗?
那么,emacs 中的交互式调试值得吗?是否可以交互式调试 google appengine 应用程序?关于我如何让它发挥作用有什么建议吗?