On Wed, Apr 1, 2009 at 6:15 AM, John Cremona <john.crem...@gmail.com> wrote: > > 2009/4/1 Joel B. Mohler <j...@kiwistrawberry.us>: >> >> On Wednesday 01 April 2009 07:44:17 am John Cremona wrote: >>> I had already tried that variation. No luck! >>> >>> mas...@host-56-150%echo $SAGE_PATH >>> /home/masgaj/sage >>> mas...@host-56-150%pwd >>> /home/masgaj/sage >>> mas...@host-56-150%sage -t /home/masgaj/sage/egros.py >>> sage -t "/home/masgaj/sage/egros.py" >>> File "./egros.py", line 18 >>> from /home/masgaj/sage/egros import * >>> ^ >>> SyntaxError: invalid syntax >> >> What about?: >> >> mas...@host-56-150%cd /home/masgaj/sage >> mas...@host-56-150%sage -t egros.py >> > > I had aready tried that too, as reported earlier: the result is much > worse since it looks as if none os sage is getting imported at all, > the first failure being NameError: global name 'QQ' is not defined > > PROBLEM SOLVED!! I added the line > > from sage.all import * > > at the top of the .py file and now all is well. I'm sure that all the > helpful people who have been firing suggestion at me cannot believe > that I did not know that I had to do that. > > Summary instructions to test a stand-alone .py file, say test.py: > > 1. No need to set any environment variables > 2. Put the line > from sage.all import * > at the top of the file > 3. cd to the directory the file is in > 4. sage -t test.py > > John
Yes. The "sage -t foo.py" thing only does "from foo import *" -- it doesn't import the whole Sage library too. Maybe it should? That would be easy to add, I think. William --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-devel@googlegroups.com To unsubscribe from this group, send email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---