Hi Florian,

On Thu, May 21, 2009 at 12:14 PM, flori <beutler.flor...@googlemail.com> wrote:
>
> the ls -lah command gives
>
> flor...@base:~/sage/sage-3.4$ ls -lah
> total 16M
> drwxr-xr-x  9 florian florian 4.0K 2009-05-21 20:09 .
> drwxr-xr-x  3 florian florian 4.0K 2009-04-19 15:38 ..
> -rw-r--r--  1 florian florian  71K 2009-04-19 15:38 COPYING.txt
> drwxr-xr-x  8 florian florian 4.0K 2009-04-19 18:17 data
> drwxr-xr-x  4 florian florian 4.0K 2009-04-19 17:15 devel
> drwxr-xr-x 16 florian florian 4.0K 2009-04-19 18:02 examples
> -rwxrwx---  1 florian florian  230 2009-05-21 20:09 factor
> -rw-r--r--  1 florian florian  228 2009-05-21 13:58 factor~
> -rw-r--r--  1 florian florian   81 2009-04-19 15:38 file.txt
>
> and
>
> flor...@base:~/sage/sage-3.4$ ./factor 2006
> /usr/bin/env: sage -python: No such file or directory

Yep, this will happen if you're trying to run the command that way. I
suggest you change the file name from

factor

to

factor.sage

Notice that you're just adding the extension ".sage" to the end of the
original file name. Since Sage is in your path variable, then just do

$ sage factor.sage 2006

and you should get the required factorization. This will work
regardless of whether or not you set the executable flag for
factor.sage. For example, here's my Sage command line session:

[mv...@sage ~]$ sage factor.sage 2006
2 * 17 * 59
[mv...@sage ~]$ cat factor.sage
#!/usr/bin/env sage -python

import sys
from sage.all import *

if len(sys.argv) != 2:
   print "Usage: %s <n>"%sys.argv[0]
   print "Outputs the prime factorization of n."
   sys.exit(1)

print factor(sage_eval(sys.argv[1]))
[mv...@sage ~]$ l -gh factor.sage
-rw-r--r-- 1 mvngu 226 2009-05-21 05:20 factor.sage


> the file content is
>
> #!/usr/bin/env sage -python
>
> import sys
> from sage.all import *
>
> if len(sys.argv) != 2:
>    print "Usage: %s <n>"%sys.argv[0]
>    print "Outputs the prime factorization of n."
>    sys.exit(1)
>
> print factor(sage_eval(sys.argv[1]))
> best regards
> florian
> sorry for the multiple posts (2 times not 3 times...) but the forum
> did not show my question and I thought I made something wrong...
> regards

-- 
Regards
Minh Van Nguyen

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to