ASKSAGE: Sage Q&A Forum - Latest question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 07 Jul 2011 10:19:00 -0500Using Sage in a Python CGI scripthttps://ask.sagemath.org/question/8215/using-sage-in-a-python-cgi-script/I am writing cgi scripts in python that use sage. I have been researching for weeks and even the python and sage websites say use: "from sage.all import *" in your python script, and have "#!/usr/bin/env sage -python" as the first line of the script.
Here is the exact quote from sagemath faq on what to do:
"
The following standalone Sage script factors integers, polynomials, etc:
#!/usr/bin/env sage -python
import sys
from sage.all import *
if len(sys.argv) != 2:
print "Usage: %s <n>"%sys.argv[0]
print "Outputs the prime factorization of n."
sys.exit(1)
print factor(sage_eval(sys.argv[1]))
In order to use this script, your SAGE_ROOT must be in your PATH."
I made the cgi file exactly as is, and put onto my web server (Apache running CentOS), with sage and python installed. When I try to run this file (named factor.cgi) through the bash terminal I do:
$ ./factor.cgi 2006
/usr/bin/env: sage -python: No such file or directory
Any help on what I should do to make this script work would be appreciated.randomness431Thu, 07 Jul 2011 10:19:00 -0500https://ask.sagemath.org/question/8215/