“Graphical” Django Debugging Without the Fatties
However, trying to drop pudb in a Django app:
from pudb import set_trace; set_trace()
throws an error:
ValueError: signal only works in main thread
because, it turns out, signals only work in the main thread of a Python application. Informative, but not helpful. Luckily, there’s a simple solution. pudb apparently uses urwid for its GUI, which is causing the problem. The PuDB wiki has the answer.
To fix it, simply find where urwid was installed (when you easy_install’d pudb). For me on OSX it was in /Library/Python/2.5/site-packages/. Once you’ve found it, edit the raw_display.py file. Find the function definitions:
Edit the functions so they are just:
That’s it! Dropping a set_trace() shows an excellent, console-based gui for your viewing pleasure.
Now go have fun out there.