I am using Eclipse (with PyDev) to delevop a web2py application. I have followed this guide to set things up. Now, I want to debug my application using Eclipse. However, for some reason, execution does not (always) stop when it reaches a breakpoint.
I have created two separate web2py apps (in two Eclipse projects). Debugging seems to work on one, but not on the other. Both projects reference the same web2py installation. Thus, independent of which project I "Run.../Debug..." in Eclipse, web2py offers both apps via the browser.
I have created a simple test file (controllers/test.py) as follows:
def index():
print 'I should break.'
print 'After the breakpoint'
return dict(test=1)
There is a breakpoint set to the first print
statement.
I have put this file in both projects (let's call them A and B).
I have the following observations:
When I launch debugging from Eclipse, the debugger stops execution whenever I hit the breakpoint in the file test.py that belongs to project A, but it seems to ignore the breakpoint in the file test.py that belongs to project B. It does not matter whether I launched web2py from (Eclipse-)project A or project B. The behavior is always the same. Breakpoints in files that belong to project A work, those in project B are ignored.
I have compared all project properties and run configuration properties and I cannot find a difference (except for the project name and path).
Execution of both projects works perfectly. E.g., the output of the print
statements of the test file shown above is always shown in the Eclipse console.
Does anybody have a clue what is going on here? What could be the difference that makes it work on project A but not on project B?
I am using Python 2.7.1.
When I set
DEBUG_TRACE_LEVEL = 3
DEBUG_TRACE_BREAKPOINTS = 3
in eclipse/plugins/org.python.pydev.debug/pysrc/pydevd_constants.py (as requested in the comments), I get the following console output:
pydev debugger: starting ('Executing file ', 'C:\misc\web2py_src\web2py\web2py.py') ('arguments:', "['C:\\misc\\web2py_src\\web2py\\web2py.py']") ('Connecting to ', '127.0.0.1', ':', '49565') ('Connected.',) ('received command ', '501\t1\t1.1') sending 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
The behavior does not change. The breakpoint in app B is ignored, while the one in app A works.
I have run into a similar problem, where i could not get breakpoints to work (pydev breakpoints not working).
No solution yet, but maybe it is useful to know that i am not using web2py.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With