PyDev中的调试控制台与AppEngine开发服务器
我正在尝试在Ubuntu上使用Eclipse/PyDev调试一个Google AppEngine项目。
调试通常没问题,但我无法在调试控制台中评估表达式。我觉得控制台在启动AppEngine服务器,并且在等待AppEngine开发服务器结束,所以我无法看到评估的提示。
这是调试控制台中的输出:
pydev debugger: warning: psyco not available for speedups (the debugger will still work correctly, but a bit slower)
pydev debugger: starting
/home/eric/src/google_appengine/google/appengine/tools/appcfg.py:42: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
import sha
/home/eric/src/google_appengine/google/appengine/tools/dev_appserver_login.py:33: DeprecationWarning: the md5 module is deprecated; use hashlib instead
import md5
INFO 2010-11-02 22:00:13,657 appengine_rpc.py:153] Server: appengine.google.com
INFO 2010-11-02 22:00:13,679 appcfg.py:414] Checking for updates to the SDK.
INFO 2010-11-02 22:00:14,010 appcfg.py:428] The SDK is up to date.
WARNING 2010-11-02 22:00:14,011 datastore_file_stub.py:818] Could not read datastore data from /tmp/dev_appserver.datastore
INFO 2010-11-02 22:00:14,080 dev_appserver_main.py:443] Running application manualent on port 8080: http://localhost:8080
注意到控制台的最后并没有打印出可以输入表达式的提示。
有没有办法让提示正确出现,这样我就可以在调试时评估表达式呢?
2 个回答
0
试试使用远程调试功能。我在使用Apache和mod_wsgi时遇到过类似的问题,后来通过设置 stdoutToServer=True
和 sterrToServer=True
来把输出信息发送到PyDev的远程调试器,从而解决了这个问题:
from pydevsrc import pydevd;pydevd.settrace('192.168.2.8', stdoutToServer=True, stderrToServer=True)
1
你有没有考虑过使用你应用程序里面的AppEngine交互式控制台呢?
http://code.google.com/appengine/docs/python/tools/devserver.html#The_Development_Console
现在服务器正在使用Python解释器,这就是为什么你看不到提示符(因为它只有一个解释器,而且已经在使用中);如果你想在服务器的环境中运行Python表达式,开发控制台就是你需要使用的工具。
还有一个更像“控制台”的交互式Python会话版本,是第三方开发者提供的:http://con.appspot.com/console/help/about