Wednesday, January 28, 2009

Debugging with app-engine-patch and pdb

If you ever tried to use pdb in application written using app-engine-patch, you should notice, that pdb is not working here at all. All pdb output is shown directly in browser. Thanks to Antonin Hildebrand from this thread now we have a way to use pdb for debugging GAE applications. Use following code to put trace in your app:

def b():
import pdb, sys
sys.__stdout__.write('\a')
sys.__stdout__.flush()
debugger = pdb.Pdb(stdin=sys.__stdin__, stdout=sys.__stdout__)
debugger.set_trace(sys._getframe().f_back)
#...
#...
##########################
b()#here I want to start tracing
For me it worked without any dev_appserver.py patches. Try it out!

0 comments:

Post a Comment