Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

There are a couple of ways of doing this. You can write a pythonscript script and import the sage module. In order to use sage commands use the following line

from sage.all import *

In order to do this you need sage in you PYHTONPATH. You can make sure it does by starting your python script with

import sys
sys.path.append('path-to-sage')

A better alternative, which I use when I am trying to do what you are doing, is that I write the python script with 'from sage.all import *' on the first line and then use the python from sage to run it using the command

sage -python

This way you can use the python interpreter of sage.