line number of error in .sage file
When sage reports an error, it reports the line number of the .py
file where the error occured. I am wondering if there is a way to configure sage so that it instead reports the line number of the code in the .sage
file that ultimately generated that problematic line in the .py
file.
This would be useful because it is the .sage
file that I am actually editing.
This is theoretically possible: other languages and transpilers use sourcemaps to solve this same issue.
What is a
.sage
file and what is a.py
file?Does
import traceback
, followed bytraceback.print_exc()
at the sensible places, not give the corresponding information?Where does which sage process report an error? Command line, interpreter?
Example: File content:
Then
and so on...
My original file is called
file.sage
(the ".sage file"). When I execute it via the terminal commandsage file.sage
, then the filefile.sage.py
(the ".py file") is automatically generated. I hope this clarifies the issue for you.