Saturday, December 4, 2010

Debugging with PDB and App Engine

Python debugger (pdb) doesn't work on App Engine SDK as usual. After adding to my project:


import pdb; pdb.set_trace()


I got:


Blocking access to skipped file "/.pdbrc"

File "/usr/lib/python2.6/bdb.py", line 46, in trace_dispatch
return self.dispatch_line(frame)
File "/usr/lib/python2.6/bdb.py", line 65, in dispatch_line
if self.quitting: raise BdbQuit


But, as posted in morethanseven, it's easy to make it work using:


import pdb
import sys
for attr in ('stdin', 'stdout', 'stderr'):
setattr(sys, attr, getattr(sys, '__%s__' % attr))
pdb.set_trace()

No comments:

Post a Comment