On Wed, Jan 14, 2009 at 8:13 AM, ben <[email protected]> wrote: > > Thanks everyone! I am unsure how to use Robert's API as I haven't been > able to find any documentation, but that may be a better idea given > the security issue that Jason raised. Does anyone know where I could > find some examples of its usage?
See the docstrings here: http://www.sagemath.org/hg/sage-main/file/b0aa7ef45b3c/sage/server/simple/twist.py > > Thanks again, > > Ben > > On Jan 13, 4:55 pm, "William Stein" <[email protected]> wrote: >> On Tue, Jan 13, 2009 at 7:15 AM, ben <[email protected]> wrote: >> >> > Hello, >> >> > I'm trying to communicate with sage using PHP. I want it to calculate >> > 1+2. I've written this little bash script: >> >> > #!/bin/bash >> > cd /usr/local/sage-3.2.1 >> > ./sage -q << END >> > 1+2 >> > END >> > read -p "Press enter to continue" >> >> > which outputs: >> >> > sage: 3 >> > sage: >> > Exiting SAGE (CPU time 0m0.04s, Wall time 0m0.04s). >> > Press enter to continue >> >> > however, when I execute the script from PHP using this: >> >> > echo exec("cd /home/ben/Desktop && ./test.sh",$out); >> > print_r($out); >> >> > it outputs: >> >> > ********************************************************************** >> > Welcome to IPython. I will try to create a personal configuration >> > directory where you can customize many aspects of IPython's >> > functionality in: /root/.sage/ipython Initializing from >> > configuration /usr/local/sage-3.2.1/local/lib/python2.5/site-packages/ >> > IPython/UserConfig Please press to start >> > IPython.********************************************************************** >> > Press enter to exit: >> >> > why do I not get the same output as when I execute the script >> > directly? is there any way stopping the welcome message being output >> > every time? how can I get the answer 3? >> >> For 1-liners use "sage -c": >> >> wst...@sage:~$ sage -c "print 1 + 2" >> 3 > > > -- William Stein Associate Professor of Mathematics University of Washington http://wstein.org --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
