The technique I used for tracebacks wouldn’t really work for pdb. For a traceback I saved all the information from the frames — mostly just the local variables — and then let the user interact with that through the browser. But with pdb you pause the application part way through waiting for user input, and the routine only completes much later.
While writing WaitForIt I played around with techniques to deal with very slow WSGI applications. Not that hard, really — you launch every request in a new thread, and you manage those requests in an application of its own. So I started thinking about pdb again, and it started seeming feasible. Whenever the app reads from stdin it goes into an interactive mode, showing you what comes out on stdout and letting you add input to stdin. It’s nothing specific to pdb really.
hg clone http://knowledgetap.com/hg/weberror/ cd weberror python setup.py develop # You need Paste trunk: easy_install Paste==dev python weberror/pdbcapture.py
What you’ll see is not polished, it’s just working, but since I mostly did it to see if I could do it, that’s good enough for me.