On Oct 16, 2007, at 7:04 PM, Steffen wrote:

>
> Hi,
>
> I tried to run the example in the sage tutorial:
>
> #!/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]))
>
>
> Running the script I get the following error:
> /usr/bin/env: sage-python: file or directory not found

You need to set up the environment correctly to run SAGE.  This is  
done automatically if you invoke sage from the command line or the  
notebook, but in your case, you are trying to run a command (sage- 
python) that [I'm guessing] isn't in your search-path.

Try this:

% bash
% PS1="SAGE> "
SAGE> . $SAGE_ROOT/local/bin/sage-env
SAGE> /Path/To/MyScript ...

FWIW, I invoke a new shell and change the prompt so I know I have  
changed the environment.  The command 'sage-env' sets things up so  
that the SAGE installation's libraries and commands will be used in  
preference to those that would normally be used.  I've ended up  
chasing my tail for a while when I forgot I did that.

Of course, your choice of shell need not match mine :-}

HTH

Justin

--
Justin C. Walker, Curmudgeon at Large
Institute for the Absorption of Federal Funds
-----------
My wife 'n kids 'n dogs are gone,
I can't get Jesus on the phone,
But Ol' Milwaukee's Best is my best friend.
-----------



--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-forum
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to