On May 1, 10:54 am, Mikie <[email protected]> wrote:
> Is it possible to do something like this at the command prompt
>
> #!/usr/bin/env sage
> import sys
> from sage.all import*
> factorial(10)
>
> and have sage calculate 10!
>
> When I do it from the cp nothing happens. When I save the file I get
> sage.all not found.
What is "cp"?
> python ?.py
>
> Does sage-python run sage's python. Can't get this to work.
"sage" is a script.
> I see many posts on this topic, but no help. Is there a tutorial?
I have seen some documentation, but I don't know where or if it is in
the manual.
> I want to use the sage.all module using python
>
> Thanks
This works:
mabsh...@sage:/scratch/mabshoff/sage-3.4.2.rc0$ ./sage -sh
Starting subshell with Sage environment variables set.
Be sure to exit when you are done and do not do anything
with other copies of Sage!
mabsh...@sage:/scratch/mabshoff/sage-3.4.2.rc0$ cat foo.py
#!/usr/bin/env python
import sys
from sage.all import *
print factorial(10)
mabsh...@sage:/scratch/mabshoff/sage-3.4.2.rc0$ ./foo.py
3628800
Note that inside the python script there is no preparser.
Cheers,
Michael
--~--~---------~--~----~------------~-------~--~----~
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-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---