我正在使用Eclipse(与PyDev一起)来删除web2py应用程序。我已经按照这个指南来设置了。现在,我想使用Eclipse调试我的应用程序。但是,由于某些原因,执行不会(总是)在到达断点时停止。
我已经创建了两个独立的web2py应用程序(在两个Eclipse项目中)。调试似乎对其中一个有效,但对另一个无效。两个项目都引用了相同的web2py安装。因此,与Eclipse中的"Run…/Debug…"项目无关,web2py通过浏览器提供这两个应用程序。
我创建了一个简单的测试文件(controllers/test.py)如下:
def index():
print 'I should break.'
print 'After the breakpoint'
return dict(test=1)
第一条print
语句设置了一个断点。
我已经把这个文件放在两个项目中(让我们称之为A和B)。
我有以下观察结果:
当我从Eclipse启动调试时,每当我在属于项目A的文件test.py中遇到断点时,调试器就会停止执行,但它似乎忽略了属于项目B的文件test.php中的断点。无论我是从(Eclipse-)项目A还是项目B启动web2py,行为都是一样的。属于项目A的文件中的断点有效,项目B中的断点被忽略。
我已经比较了所有项目属性和运行配置属性,但找不到任何区别(除了项目名称和路径)。
两个项目的执行都很顺利。例如,上面显示的测试文件的print
语句的输出始终显示在Eclipse控制台中。
有人知道这里发生了什么吗?它在项目A上有效而在项目B上无效的区别是什么?
我使用的是Python 2.7.1。
当我设置时
DEBUG_TRACE_LEVEL = 3
DEBUG_TRACE_BREAKPOINTS = 3
在eclipse/plugins/org.python.pydev.debug/pysrc/pydv_constants.py中(如注释中所要求的),我得到以下控制台输出:
pydev调试器:启动("执行文件","C:\misc\web2py_src\web2py\web2py.py")('论点:',"['C:\\misc\\web2py_src\\web2py\\web2py.py']")("连接到"、"127.0.0.1"、":"、"49565")("已连接",)('接收到的命令','501\t1\t1.1')发送命令:cmd_VERSION 501 1 1.1
sending cmd: CMD_THREAD_CREATE 103 2 <xml><thread name="pydevd.reader" id="-1"/></xml>
sending cmd: CMD_THREAD_CREATE 103 4 <xml><thread name="pydevd.writer" id="-1"/></xml>
('received command ', '111t3tC:\misc\workspace\Newtoon\controllers\test.pyt12t**FUNC**indextNone')
Added breakpoint:c:miscworkspacenewtooncontrollerstest.py - line:12 - func_name:index
('received command ', '111t5tC:\misc\workspace\Newtoon\controllers\importer.pyt11t**FUNC**indextNone')
Added breakpoint:c:miscworkspacenewtooncontrollersimporter.py - line:11 - func_name:index
('received command ', '111t7tC:\misc\web2py_src\web2py\applications\GeorgsTestApp\controllers\unique_names.pyt6t**FUNC**indextNone')
Added breakpoint:c:miscweb2py_srcweb2pyapplicationsgeorgstestappcontrollersunique_names.py - line:6 - func_name:index
('received command ', '111t9tC:\misc\web2py_src\web2py\applications\GeorgsTestApp\controllers\test.pyt12t**FUNC**indextNone')
Added breakpoint:c:miscweb2py_srcweb2pyapplicationsgeorgstestappcontrollerstest.py - line:12 - func_name:index
('received command ', '122t11t;;')
Exceptions to hook : []
('received command ', '124t13t')
('received command ', '101t15t')
No handlers could be found for logger "web2py"
web2py Web Framework
Created by Massimo Di Pierro, Copyright 2007-2011
Version 1.99.4 (2011-12-14 14:46:14) stable
Database drivers available: SQLite3, pymysql
Starting hardcron...
WARNING:web2py.cron:WEB2PY CRON: Disabled because no file locking
sending cmd: CMD_THREAD_CREATE 103 6 <xml><thread name="MainThread" id="pid5740_seq4" /></xml>
sending cmd: CMD_THREAD_CREATE 103 8 <xml><thread name="Thread-4" id="pid5740_seq5" /></xml>
please visit:
http://127.0.0.1:8000
starting browser...
sending cmd: CMD_THREAD_CREATE 103 10 <xml><thread name="Dummy-7" id="pid5740_seq6" /></xml>
sending cmd: CMD_THREAD_CREATE 103 12 <xml><thread name="Dummy-6" id="pid5740_seq7" /></xml>
sending cmd: CMD_THREAD_CREATE 103 14 <xml><thread name="Thread-13" id="pid5740_seq8" /></xml>
sending cmd: CMD_THREAD_CREATE 103 16 <xml><thread name="Thread-10" id="pid5740_seq9" /></xml>
sending cmd: CMD_THREAD_CREATE 103 18 <xml><thread name="Thread-11" id="pid5740_seq10" /></xml>
sending cmd: CMD_THREAD_CREATE 103 20 <xml><thread name="Port8000" id="pid5740_seq11" /></xml>
sending cmd: CMD_THREAD_CREATE 103 22 <xml><thread name="Thread-12" id="pid5740_seq12" /></xml>
sending cmd: CMD_THREAD_CREATE 103 24 <xml><thread name="Thread-8" id="pid5740_seq13" /></xml>
sending cmd: CMD_THREAD_CREATE 103 26 <xml><thread name="Thread-9" id="pid5740_seq14" /></xml>
sending cmd: CMD_THREAD_CREATE 103 28 <xml><thread name="Thread-16" id="pid5740_seq15" /></xml>
sending cmd: CMD_THREAD_CREATE 103 30 <xml><thread name="Thread-15" id="pid5740_seq16" /></xml>
sending cmd: CMD_THREAD_CREATE 103 32 <xml><thread name="Thread-18" id="pid5740_seq17" /></xml>
sending cmd: CMD_THREAD_CREATE 103 34 <xml><thread name="Thread-14" id="pid5740_seq18" /></xml>
sending cmd: CMD_THREAD_CREATE 103 36 <xml><thread name="Thread-17" id="pid5740_seq19" /></xml>
WARNING:web2py.cron:WEB2PY CRON: Disabled because no file locking
I should break.
After the breakpoint
sending cmd: CMD_THREAD_SUSPEND 105 38 <xml><thread id="pid5740_seq12" stop_reason="111"><frame id="97199496" name="index" file="c%253A%255Cmisc%255Cweb2py_src%255Cweb2py%255Capplications%255Cgeorgstestapp%255Ccontrollers%255Ctest.py" line="12">"</frame><frame id="95957960" name="%26lt%3Blambda%26gt%3B" file="c%253A%255Cmisc%255Cweb2py_src%255Cweb2py%255Cgluon%255Cglobals.py" line="172">"</frame><frame id="100912680" name="%26lt%3Bmodule%26gt%3B" file="c%253A%255Cmisc%255Cweb2py_src%255Cweb2py%255Capplications%255Cgeorgstestapp%255Ccontrollers%255Ctest.py" line="19">"</frame><frame id="66219576" name="restricted" file="c%253A%255Cmisc%255Cweb2py_src%255Cweb2py%255Cgluon%255Crestricted.py" line="204">"</frame><frame id="96138760" name="run_controller_in" file="c%253A%255Cmisc%255Cweb2py_src%255Cweb2py%255Cgluon%255Ccompileapp.py" line="537">"</frame><frame id="96513256" name="serve_controller" file="c%253A%255Cmisc%255Cweb2py_src%255Cweb2py%255Cgluon%255Cmain.py" line="202">"</frame><frame id="62835496" name="wsgibase" file="c%253A%255Cmisc%255Cweb2py_src%255Cweb2py%255Cgluon%255Cmain.py" line="493">"</frame><frame id="62834872" name="app_with_logging" file="c%253A%255Cmisc%255Cweb2py_src%255Cweb2py%255Cgluon%255Cmain.py" line="676">"</frame><frame id="96071288" name="run_app" file="c%253A%255Cmisc%255Cweb2py_src%255Cweb2py%255Cgluon%255Crocket.py" line="1994">"</frame><frame id="66212296" name="run" file="c%253A%255Cmisc%255Cweb2py_src%255Cweb2py%255Cgluon%255Crocket.py" line="1302">"</frame><frame id="95948632" name="__bootstrap_inner" file="c%253A%255Cpython27%255Clib%255Cthreading.py" line="530">"</frame><frame id="96053672" name="__bootstrap" file="c%253A%255Cpython27%255Clib%255Cthreading.py" line="503">"</frame></thread></xml>
WARNING:web2py.cron:WEB2PY CRON: Disabled because no file locking
('received command ', '106t17tpid5740_seq12')
('processing internal command ', '<pydevd_comm.InternalRunThread instance at 0x0000000005F82E88>')
I should break.
After the breakpoint
sending cmd: CMD_THREAD_RUN 106 40 pid5740_seq12 None
行为不会改变。应用程序B中的断点被忽略,而应用程序A中的断点有效。
我遇到了一个类似的问题,我无法让断点工作(pydev断点不工作)。
还没有解决方案,但也许知道我没有使用web2py是有用的。