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 > You can't specify paths in python imports even though it feels like a logical > thing to do. Perhaps 'sage -t' should handle a full path name by doing > a 'cd' and trimming the path off the file name. > > -- > Joel > > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---