On 21 May 2009, at 06:53, Kevin Horton wrote: > On 21 May 2009, at 02:22, flori wrote: > >> I would like to write a script using sage and I just followed the >> tutorial page 82. I copied the example >> >> #!/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])) >> >> to a file which I named factor (without filetype!). I set the env. >> variable >> >> export SAGE_ROOT=/home/florian/sage/sage-3.4/ >> >> and I tried to run the scripts as explained in the tutorial... >> >> ./factor 2006 >> >> the result was >> >> flor...@base:~/sage/sage-3.4$ sudo ./factor 2006 >> sudo: ./factor: command not found > > > Is the sage executable in your PATH?
It is obviously more complicated than I thought. I played around with your script on my machine, and I get the same result you do, even with sage in my PATH. But, it works properly if I change the #! line in the script to point directly to sage, e.g: #! /path/to/sage -python I don't understand why this makes a difference. -- Kevin Horton Ottawa, Canada --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---