Ask Your Question

set_trace() analog for Sage

asked 2021-07-14 15:24:39 +0200

petRUShka gravatar image

In sage one can use import pdb;pdb.set_trace() or in case of tests: import pytest; pytest.set_trace(). But these commands invoke pure python console without Sage improvements.

Are there something like sage.set_trace() command which opens Sage REPL instead if Python REPL?

edit retag flag offensive close merge delete


Did you try import pdb;pdb.set_trace()in a Sage terminal ?

Emmanuel Charpentier gravatar imageEmmanuel Charpentier ( 2021-07-15 17:31:05 +0200 )edit

It's no use I think. Good to have pdb when you run file like sage file.sage. But I tried and it is standard pdb without any Sage features.

petRUShka gravatar imagepetRUShka ( 2021-07-17 20:48:05 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2021-07-17 16:48:39 +0200

tkarn gravatar image

updated 2021-07-17 16:50:33 +0200

If you are using Sage in the terminal, you can simply type pdb and it will turn on the debugger when an error is raised. This does not quite answer your question, but might help a bit.

sage: pdb
Automatic pdb calling has been turned ON

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2021-07-14 15:24:39 +0200

Seen: 168 times

Last updated: Jul 17 '21