This is just a short note on how to use the Eric4 program to debug a Sage script (a .py file). It's a slightly updated version of a post on some Sage mailing list that I can't find right now.
On Ubuntu 9.04, install Eric4:
sudo apt-get install eric
Save the following to a file:
Start Eric4 and go to Settings, Preferences, Debugger/Python, and set the Custom Python Interpreter to the file that you just saved.
Using File, Open you can debug a Python file that uses the Sage libraries, e.g.:
from sage.all import *
To set a breakpoint in the Sage library itself use the ? sign to find out where a file is located. For example
shows us that PolynomialRing comes from
If you open that file (File, Open) you can set breakpoints and so on.
A note to netbook users: Eric4's default window is quite large and did not display properly on my Asus EEE PC. The solution is to remove most of the toolbar entries (these are accessible from the menu anyway) and also change the window mode to detached windows so that you can alt-tab between the various components of Eric4 instead of having them all in one giant window.