Debugging in web2py

855 views
Skip to first unread message

Web2Py Freak

unread,
Feb 2, 2012, 3:39:40 PM2/2/12
to web2py-users
Dear All ,

how can i use debugging in web2py are they any easy to use debugging
tools ?

Ross Peoples

unread,
Feb 2, 2012, 4:11:58 PM2/2/12
to web...@googlegroups.com
Run web2py from console, and put "import pdb; pdb.set_trace()" right above the line of code where you want to start debugging. From there, use "n" to go to the next line, "s" to "step into" the next line, and "c" to continue execution.

Good luck!

Ross Peoples

unread,
Feb 2, 2012, 4:14:50 PM2/2/12
to web...@googlegroups.com
Forgot to mention that when the debugger pauses on a line of code, besides using the key commands mentioned before, you can run single-line Python commands as if you were in an interactive session.

This allows you to inspect variables and such. For example, once the debugger pauses and displays the (Pdb) prompt, you can type "print request" to print the entire contents of the request object to the console.

Web2Py Freak

unread,
Feb 2, 2012, 4:22:49 PM2/2/12
to web2py-users
What i want to do is to use debugging in an application that i
integrated with PayPal and its working on Apache , i get some vars in
the url from paypal and am trying to save them in the database but
something happens .. so any ideas how can i debug that !!

Mariano Reingart

unread,
Feb 2, 2012, 4:44:43 PM2/2/12
to web...@googlegroups.com
With apache, you can try a remote debugger like winpdb.

I'm working on a simple approach for web2py based on a simple debugger
(qdb, an enhancement to pdb).

Please see the following page for further instructions:

http://code.google.com/p/rad2py/wiki/QdbRemotePythonDebugger

Basically:

* copy qdb.py to modules
* insert "import qdb; qdb.set_trace()" in your controller to start the debugger
* run "python qdb.py" from the command line to debug

The commands are very similar to pdb, you can evaluate expressions and
execute statements, set breakpoints, jump, etc.
If you need to connect from a remote machine, open the qdb.py file and
change the host address (currently it is 'localhost' port 3000 per
default)

Best regards,

Mariano Reingart
http://www.sistemasagiles.com.ar
http://reingart.blogspot.com

pbreit

unread,
Feb 2, 2012, 7:06:50 PM2/2/12
to web...@googlegroups.com

Mariano Reingart

unread,
Feb 3, 2012, 8:20:09 AM2/3/12
to web...@googlegroups.com
Also, look at this new integrated online debugger for web2py:

http://reingart.blogspot.com/2012/02/new-web2py-online-python-debugger.html

I've finished it recently, so let me know if you try it and have any issue.

if you are using apache (prefork, and to a lesser extent mpm worker) you would have to adapt the configuration or use modwsgi in daemon mode:


Best regards

ramkrishan bhatt

unread,
Feb 3, 2012, 11:33:51 PM2/3/12
to web...@googlegroups.com
I am using eclipse and wing IDE , Debugging is working with web2py. 

Web2Py Freak

unread,
Feb 5, 2012, 4:24:43 AM2/5/12
to web2py-users
i am trying to use wing but how can i use it on a application that is
deployed on apache
Reply all
Reply to author
Forward
0 new messages