On 10/17/07, Pierre <[EMAIL PROTECTED]> wrote: > thanks for your message! i'm confused with one thing: > > > > -- and then for standalone scripts i use > > > #!/usr/bin/env sage > > > Yep, that should work fine. That's for a script that > > is written using Sage. You can also use > > > > #!/usr/bin/env sage -python > > > > for a script that uses the Python included with Sage. > > i'm not 100% sure if i understand the difference between the two. My > guess is: 'sage -python' uses the version of python coming with sage, > and that's all; whereas 'sage' does in fact a bit more, in that it > sets up the sage library somehow. Is that it ?
Actually, there really isn't much of a difference. The best thing to do is just use #!/usr/bin/env sage since on some systems having a space in the command name given to /usr/bin/env doesn't work. Really, the main difference is just that putting "sage" works and putting "sage -python" doesn't for a generic shell script. HOWEVER, if you make a script that has a filename that ends in .sage, then make the first line #!/usr/bin/env sage then the code inside the script is evaluated as if you typed it on the Sage command line, so you do *not* have to type from sage.all import * and the input is preparsed. I.e., [EMAIL PROTECTED]:~/tmp$ more foo.sage #!/usr/bin/env sage print 2^3 [EMAIL PROTECTED]:~/tmp$ ./foo.sage 8 BUT, [EMAIL PROTECTED]:~/tmp$ more foo # file doesn't end in .py #!/usr/bin/env sage print 2^3 [EMAIL PROTECTED]:~/tmp$ ./foo 1 # <--------------------------- not 8 -- no preparsing Clearly the tutorial needs to be improved to reflect this. > (btw while i'm at it, thanks a lot for your work on sage, it's great. > At the moment i'm writing some C++ programs and i'm using sage to help > them get information from GAP and run in the right order accordingly, > it's brilliantly convenient) I'm glad you're finding Sage useful. Thanks for asking questions. -- William --~--~---------~--~----~------------~-------~--~----~ 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/ -~----------~----~----~----~------~----~------~--~---
