我正在使用 Google App Engine 的开发版本(版本 1.9.14.1225)构建一个基本站点,但我不知道如何进入调试器以确定我的模板变量未呈现的原因。
App Engine 文档说要使用:import pdb; pdb.set_trace();
https://cloud.google.com/appengine/docs/python/tools/devserver#Python_Debugging_with_PDB
但是,当我将 pdb 插入我的代码时,它抛出了这个错误:
如果 self 退出:提高 BdbQuit
如何进入pdb调试器?
ERROR 2014-10-30 14:25:16,768 webapp2.py:1552]
Traceback (most recent call last):
File "/Users/Bryan/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1529, in __call__
rv = self.router.dispatch(request, response)
File "/Users/Bryan/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1529, in __call__
rv = self.router.dispatch(request, response)
File "/Users/Bryan/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1278, in default_dispatcher
return route.handler_adapter(request, response)
File "/Users/Bryan/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 1102, in __call__
return handler.dispatch()
File "/Users/Bryan/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
File "/Users/Bryan/Desktop/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.2/webapp2.py", line 570, in dispatch
return method(*args, **kwargs)
File "/Users/Bryan/work/GoogleAppEngine/dermalfillersecrets/main.py", line 94, in get
self.response.write(template.render(template_values))
File "/Users/Bryan/work/GoogleAppEngine/dermalfillersecrets/main.py", line 94, in get
self.response.write(template.render(template_values))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/bdb.py", line 49, in trace_dispatch
return self.dispatch_line(frame)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/bdb.py", line 68, in dispatch_line
if self.quitting: raise BdbQuit
操作系统 10.9.5
请您参考如下方法:
看起来like there is a known issue使用 PDB 和 Mac。我会给它“加注星标”以增加权重,并评论说你仍然看到这个问题。
看起来是因为 PDB 使用 stdin/stdout 进行 i/o 而 MAC dev_server 不能与它们一起工作。
看起来有一个 third party tool那应该工作。
这里看起来像you can re-direct I/O,我没有 Mac 来测试您可以重定向的位置,但可能会有帮助。
还有这个工具到redirect the I/O到 socket 。不确定它是否有效,但我认为我会包括它以防万一。
