1 | initial version |
One more attempt at an answer: perhaps the shell in VirtualBox doesn't accept the syntax #!/usr/bin/env sage -python
some shells balk at having more than one term after "/usr/bin/env". So changing this first line to #!/usr/bin/env python
and executing it with sage -sh -c './factor 2012'
should work, as should first running sage -sh
and then ./factor 2012
. In either case, sage -sh
tells /usr/bin/env python
to use Sage's version of Python, which knows how to import the Sage library (from the line from sage.all import *
).
That's my guess. See Wikipedia's article on 'Shebang (Unix)' I don't know how to add the link here, since the link has a right parenthesis in it, which conflicts with the markup here for links and in particular the part which says
Another portability problem is the interpretation of the command arguments. Some systems, including Linux, do not split up the arguments;[11] for example, when running the script with the first line like,
`#!/usr/bin/env python -c`
That is, python -c will be passed as one argument to /usr/bin/env, rather than two arguments. Cygwin also behaves this way.
While the original script (with #!/usr/bin/env sage -python
) works on my OS X box, it doesn't work on a linux machine that I have access to. This part of the tutorial needs to be fixed, I think.
2 | No.2 Revision |
Edit: try replacing the first line with #!/usr/bin/env sage
. That might bypass all of the problems described below.
One more attempt at an answer: perhaps the shell in VirtualBox doesn't accept the syntax #!/usr/bin/env sage -python
some shells balk at having more than one term after "/usr/bin/env". So changing this first line to #!/usr/bin/env python
and executing it with sage -sh -c './factor 2012'
should work, as should first running sage -sh
and then ./factor 2012
. In either case, sage -sh
tells /usr/bin/env python
to use Sage's version of Python, which knows how to import the Sage library (from the line from sage.all import *
).
That's my guess. See Wikipedia's article on 'Shebang (Unix)' I don't know how to add the link here, since the link has a right parenthesis in it, which conflicts with the markup here for links and in particular the part which says
Another portability problem is the interpretation of the command arguments. Some systems, including Linux, do not split up the arguments;[11] for example, when running the script with the first line like,
`#!/usr/bin/env python -c`
That is, python -c will be passed as one argument to /usr/bin/env, rather than two arguments. Cygwin also behaves this way.
While the original script (with #!/usr/bin/env sage -python
) works on my OS X box, it doesn't work on a linux machine that I have access to. This part of the tutorial needs to be fixed, I think.