Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

No, because Sage is (more or less) a superset of Python. If you make your file my_file.sage instead of my_file.py, that would clear up some of the trouble, if you run it from within Sage.

You aren't quite clear how you're running this. The best way to do it is to open Sage, and then use the load or attach commands to attach this specific file (use load? or attach? to get more info from within Sage). I'm assuming you're using the command line.

If you're doing it from Sage's Python or some other Python that has access to Sage (somehow), then you may need to put a blanket import statement like from sage.all import * at the top of your file - there are other questions on this help forum which can help you. Good luck and please follow up with more information about your situation if you need to!