Debug Python bottle apps using WingIDE

I am writing a Python Bottle application (Python 2.7.2 and Bottle 0.10.9) and developing it in WingIDE (3.2.8-1) Professional for Linux. All this works well, unless I want to debug the Bottle app. It works for me offline in WingIDE, but it will not stop at any of my breakpoints in the code, even if I set Bottle.debug (False). Does anyone have any suggestions / ideas on how I can set up the Bottle so that it stops at breakpoints in WingIDE?

+4
source share
2 answers

If you have the loader set to true, the checkbox starts the subprocess for the actual application. In Wing, you need to disable reloading, then it should work.

run(reloader=False). 

But you will have to restart the application in the wing every time you make changes.

+4
source

Do you debug under WSGI with wingdbstub.py or run a bottle from the IDE? I am not familiar with the bottle, but a common problem is the mechanism for reloading the web framework in a subprocess that is not debugging. However, Iโ€™m not sure if the bottle will do this under WSGI, but print the process identifier during the import of wingdbstub (or start when starting from the IDE), and again on the line where the breakpoint is missing, it will control this in our mode. Here, the โ€œrebooterโ€ arg for Bottle .__ init__ may be appropriate. If set to True, try setting it to False when debugging under Wing.

Another thing to try is to create an exception specifically where the breakpoint is (for example, "assert 0", "test exception" "and see if this exception is reported in the Wing debugger in the Exceptions tool, and if so, whether Wing also controls to open the source code.If the bottle works with code that cannot find the source code, it will still dwell on the statement (the Wing debugger stops on all statements by default, even if the host code handles the exception), but it couldnโ€™t display debug file and placed would be a message in the status area (on the IDE screen flag and in the Messages tool) that indicates the name of the file specified by the debugging process. Depending on this, this may be possible to fix the problem (but for this you will need to modify the flag if the file name looks on the" ".

BTW, to insert code that runs only under the Wing debugger, something like this:

import os if "WINGDB_ACTIVE" in os.environ: # code here

If this does not help, please email support on the wingware dot website.

+3
source

All Articles