我正在使用Eclipse(带有PyDev)开发web2py应用程序。我已经按照这个指南进行了设置。现在,我想使用Eclipse调试我的应用程序。然而,由于某种原因,当它到达断点时,执行并不总是停止。
我创建了两个单独的web2py应用程序(在两个Eclipse项目中)。调试似乎在其中一个上起作用,但在另一个上不起作用。两个项目都引用相同的web2py安装。因此,无论我在Eclipse中运行哪个项目,web2py都通过浏览器提供两个应用程序。
我创建了一个简单的测试文件(controllers/test.py),如下所示:
在eclipse/plugins/org.python.pydev.debug/pysrc/pydevd_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:CMD_VERSION 501 1 1.1
行为没有改变。应用程序B中的断点被忽略,而应用程序A中的断点有效。
我创建了两个单独的web2py应用程序(在两个Eclipse项目中)。调试似乎在其中一个上起作用,但在另一个上不起作用。两个项目都引用相同的web2py安装。因此,无论我在Eclipse中运行哪个项目,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.py文件中的断点。无论我是从(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/pydevd_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: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 ', '111\t3\tC:\\misc\\workspace\\Newtoon\\controllers\\test.py\t12\t**FUNC**index\tNone')
Added breakpoint:c:\misc\workspace\newtoon\controllers\test.py - line:12 - func_name:index
('received command ', '111\t5\tC:\\misc\\workspace\\Newtoon\\controllers\\importer.py\t11\t**FUNC**index\tNone')
Added breakpoint:c:\misc\workspace\newtoon\controllers\importer.py - line:11 - func_name:index
('received command ', '111\t7\tC:\\misc\\web2py_src\\web2py\\applications\\GeorgsTestApp\\controllers\\unique_names.py\t6\t**FUNC**index\tNone')
Added breakpoint:c:\misc\web2py_src\web2py\applications\georgstestapp\controllers\unique_names.py - line:6 - func_name:index
('received command ', '111\t9\tC:\\misc\\web2py_src\\web2py\\applications\\GeorgsTestApp\\controllers\\test.py\t12\t**FUNC**index\tNone')
Added breakpoint:c:\misc\web2py_src\web2py\applications\georgstestapp\controllers\test.py - line:12 - func_name:index
('received command ', '122\t11\t;;')
Exceptions to hook : []
('received command ', '124\t13\t')
('received command ', '101\t15\t')
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 ', '106\t17\tpid5740_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中的断点有效。