Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Here's one way to use Emacs' Grand Unified Debugger (GUD) with the Sage library:

  • Ensure sage is in the PATH.
  • cd SAGE_ROOT
  • cp local/lib/python/pdb.py .
  • Change the first line of pdb.py to #!/usr/bin/env sage
  • Run emacs and type M-x pdb + <ENTER>
  • Use Run pdb (like this): ./pdb.py foo.py to debug foo.py.

Caveats:

  • foo.py should contain a statement like from sage.all import *, in order to use Sage library code.
  • The code in foo.py should not require the Sage preparser. You'll need to use R = PolynomialRing(QQ, 'a,b,c'), for example, instead of R.<a,b,c> = QQ[].

I hope there's a better way! But with this approach, stepping into R = PolynomialRing(QQ, 'a,b,c') will make Emacs jump to the appropriate line of polynomial_ring_constructor.py.