[sage-support] Re: Sage Scripts

2011-04-18 Thread achrzesz
Hello nkulmati

If you want to get rid of virtualization
maybe you should try Linux version without instalation
burning Live-CD first
The present version fits into memory and after (rather long)
start process the CD can be removed

It works quite satisfactory (if you have >=2GB RAM)

The native Linux version is much much better

Andrzej Chrzeszczyk

On 18 Kwi, 16:19, "A. Jorge Garcia"  wrote:
> I tried VMs years ago (not for SAGE) and I REALLY did not like how many
> resources are needed to run the simplest app.
>
> I tend to run natively now (I use Ubuntu Linux for SAGE). If you are
> stuck with Windows, you may have to increase your RAM. How much RAM are
> you using?
>
> In any case, I would recommend Linux boxes
>
> HTH,
> A. Jorge Garcia
> Applied Math and 
> CompScihttp://shadowfaxrant.blogspot.comhttp://www.youtube.com/calcpage2009
>
> -Original Message-
> From: Simon King 
> To: sage-support 
> Sent: Mon, Apr 18, 2011 9:27 am
> Subject: [sage-support] Re: Sage Scripts
>
> On 17 Apr., 04:57, nkulmati  wrote:
> > However, I had a major disappointment. I wrote a short script, and it
> > is apparently too much for sage/python to handle when I am running a
> > virtual machine from Win 7. I use process monitor and it goes like
> > this: when I run my script, both the CPU and RAM usage (in virtual
> > machine) SHOOT up to 100%, and then swapping begins, after two minutes
> > or so the CPU falls back to around 0 but the memory never gets
> > released back from 100%, and my whole ubuntu, the whole virtual
> > machine, freezes. (While the system monitor still shows steady 100%
> > usage of memory). I have to restart the VM.
>
> I never worked with a virtual machine in Windows, so, I am not really
> an expert. However, I thought it should be possible to use something
> like ulimit in order to prevent the VM from freezing (simply because
> the application is killed before the VM freezes)?
>
> Cheers,
> Simon
>
> --
> 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 
> athttp://groups.google.com/group/sage-support
> URL:http://www.sagemath.org
>
>

-- 
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
URL: http://www.sagemath.org


Re: [sage-support] Re: Sage Scripts

2011-04-18 Thread A. Jorge Garcia
I tried VMs years ago (not for SAGE) and I REALLY did not like how many 
resources are needed to run the simplest app.


I tend to run natively now (I use Ubuntu Linux for SAGE). If you are 
stuck with Windows, you may have to increase your RAM. How much RAM are 
you using?


In any case, I would recommend Linux boxes

HTH,
A. Jorge Garcia
Applied Math and CompSci
http://shadowfaxrant.blogspot.com
http://www.youtube.com/calcpage2009


-Original Message-
From: Simon King 
To: sage-support 
Sent: Mon, Apr 18, 2011 9:27 am
Subject: [sage-support] Re: Sage Scripts

On 17 Apr., 04:57, nkulmati  wrote:

However, I had a major disappointment. I wrote a short script, and it
is apparently too much for sage/python to handle when I am running a
virtual machine from Win 7. I use process monitor and it goes like
this: when I run my script, both the CPU and RAM usage (in virtual
machine) SHOOT up to 100%, and then swapping begins, after two minutes
or so the CPU falls back to around 0 but the memory never gets
released back from 100%, and my whole ubuntu, the whole virtual
machine, freezes. (While the system monitor still shows steady 100%
usage of memory). I have to restart the VM.


I never worked with a virtual machine in Windows, so, I am not really
an expert. However, I thought it should be possible to use something
like ulimit in order to prevent the VM from freezing (simply because
the application is killed before the VM freezes)?

Cheers,
Simon

--
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

URL: http://www.sagemath.org


--
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
URL: http://www.sagemath.org


[sage-support] Re: Sage Scripts

2011-04-18 Thread Simon King
On 17 Apr., 04:57, nkulmati  wrote:
> However, I had a major disappointment. I wrote a short script, and it
> is apparently too much for sage/python to handle when I am running a
> virtual machine from Win 7. I use process monitor and it goes like
> this: when I run my script, both the CPU and RAM usage (in virtual
> machine) SHOOT up to 100%, and then swapping begins, after two minutes
> or so the CPU falls back to around 0 but the memory never gets
> released back from 100%, and my whole ubuntu, the whole virtual
> machine, freezes. (While the system monitor still shows steady 100%
> usage of memory). I have to restart the VM.

I never worked with a virtual machine in Windows, so, I am not really
an expert. However, I thought it should be possible to use something
like ulimit in order to prevent the VM from freezing (simply because
the application is killed before the VM freezes)?

Cheers,
Simon

-- 
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
URL: http://www.sagemath.org


Re: [sage-support] Re: Sage Scripts

2011-04-17 Thread Dan Drake
On Sat, 16 Apr 2011 at 07:57PM -0700, nkulmati wrote:
> This whole "python-under virtual-machine" idea renders sage impossible
> to use!!

Actually, it renders Sage "possible to use" for many people. Remember
that you can always use one of the public Sage servers or set up one of
your own -- as those work in web browsers, they'll be fine if you use
Windows.

> So is this really a matlab/etc substitute?? :( So disappointed.

Right now the Windows situation isn't so great, but we're trying to
improve that. If you know how to work with Cygwin, you could help move
the Cygwin port along.


Dan

--
---  Dan Drake
-  http://mathsci.kaist.ac.kr/~drake
---


signature.asc
Description: Digital signature


[sage-support] Re: Sage Scripts

2011-04-16 Thread nkulmati
Thanks for your replies! They helped.

However, I had a major disappointment. I wrote a short script, and it
is apparently too much for sage/python to handle when I am running a
virtual machine from Win 7. I use process monitor and it goes like
this: when I run my script, both the CPU and RAM usage (in virtual
machine) SHOOT up to 100%, and then swapping begins, after two minutes
or so the CPU falls back to around 0 but the memory never gets
released back from 100%, and my whole ubuntu, the whole virtual
machine, freezes. (While the system monitor still shows steady 100%
usage of memory). I have to restart the VM.

This is frustrating! Is sage really NOT to be used under Windows??
Even without my script, the notebook is pretty slow (like everything
in the virtual machine). This whole "python-under virtual-machine"
idea renders sage impossible to use!! So is this really a matlab/etc
substitute?? :( So disappointed.

-- 
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
URL: http://www.sagemath.org


[sage-support] Re: Sage Scripts

2011-04-09 Thread Kelvin Li
> In the case of "G.plot()", that function returns a graphics object. To
> save your plot as an image, you can do something such as:
>
>     G.plot.save("my_plot.png")

Oops, that should be

 G.plot().save("my_plot.png")

-- Kelvin

-- 
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
URL: http://www.sagemath.org


[sage-support] Re: Sage Scripts

2011-04-09 Thread Kelvin Li
On Apr 9, 10:23 pm, nkulmati  wrote:
> Hi All, I am a newbie to Sage. My main purpose is to write scripts
> (algorithms). That is, I am not interested in the "answer-question"
> approach of the notebook, but I want to write and execute ".sage"
> files using sage just as I do with ".m" files using Matlab, for
> example.
>
> So I found this page:http://www.sagemath.org/doc/tutorial/programming.html
>
> However, when I use "load test.sage", everything works (variables get
> created and computed) but there is no output like the one I get by
> entering my algorithm line-by-line directly.
>
> For example, the command "G.plot()" gets totally ignored by the "load'
> function.
>

"load" is not ignoring "G.plot()". The function is actually executed,
but the return value is lost. It can be assigned to a variable with:

my_plot_object = G.plot()

There's a couple of things you can do to see your output.

In the case of "G.plot()", that function returns a graphics object. To
save your plot as an image, you can do something such as:

G.plot.save("my_plot.png")

See: [http://www.sagemath.org/doc/reference/sage/plot/
plot.html#sage.plot.plot.Graphics.save]
for more information.

In the Sage notebook, if "G.plot()" is not the last line of a cell,
the return value is similarly thrown away. In the notebook,
additionally, the output can be directly shown with:

G.plot().show()

See: [http://www.sagemath.org/doc/reference/sage/plot/
plot.html#sage.plot.plot.Graphics.show]
for more information.

If you want to output some line of text, you'll need to use the print
statement. If "my_result" is the variable containing the result of
your computation, you can use:

print my_result

Same story for the notebook as explained above.

> How can I use sage to run scripts that involve real-time plotting and
> other output?

I'm not sure what you mean by this. You can try looking at the
@interact decorator in the Sage notebook.

As an unrelated side note, you can also run sage scripts directly from
the command line with:

sage my_sage_script.sage

This will work if you add your sage installation directory to your
$PATH variable. See "sage --help" for more info.

Hope this answers some of your questions.

-- Kelvin

-- 
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
URL: http://www.sagemath.org


[sage-support] Re: sage scripts

2009-05-22 Thread Soroosh

I just want to point out that running sage under sudo is not
advisable. Doing so will give sage super user privilages, which it
does not need, and can cause serious security issues.

Soroosh

On May 21, 10:27 pm, flori  wrote:
> Thanks a lot for your replies...
>
> The following two commands work now
>
> flor...@base:~/sage/sage-3.4$ sudo ./sage factor.sage 2006
> 2 * 17 * 59
>
> and
>
> flor...@base:~/sage/sage-3.4$ sudo ./sage ./factor 2006
> 2 * 17 * 59
>
> In the second case I changed the first line of the file to
>
> #! /path/to/sage -python
>
> as suggested by Kevin
>
> Nevertheless there is still the mess with the execute rights. I am a
> newbie in linux and therefore I am not sure what I am doing wrong.
> with
>
> chmod 777 factor
>
> I gave all right to everybody, but still if I try
>
> flor...@base:~/sage/sage-3.4$ ./sage ./factor 2006
> [Errno 13] Permission denied: '/home/florian/.sage//temp'
>
> Furthermore I can't start sage with the command sage I need to type
>
> sudo ./sage
>
> thank you very much
> and best regards
> florian
>
> p.s.
>
> flor...@base:~/sage/sage-3.4$ ls -l
> total 15684
> -rw-r--r--  1 florian florian    71842 2009-04-19 15:38 COPYING.txt
> drwxr-xr-x  8 florian florian     4096 2009-04-19 18:17 data
> drwxr-xr-x  4 florian florian     4096 2009-04-19 17:15 devel
> drwxr-xr-x 16 florian florian     4096 2009-04-19 18:02 examples
> -rw-r--r--  1 florian florian      243 2009-05-22 10:20 factor
> -rw-r--r--  1 florian florian      228 2009-05-22 10:17 factor~
> -rw-r--r--  1 root    root         475 2009-05-22 10:21 factor.py
> -rwxr-xr-x  1 florian florian      228 2009-05-22 10:17 factor.sage
> -rw-r--r--  1 florian florian      245 2009-05-22 10:14 factor.sage~
> -rw-r--r--  1 florian florian       81 2009-04-19 15:38 file.txt
> -rw-r--r--  1 florian florian   428348 2009-04-19 15:38 HISTORY.txt
> -rw-r--r--  1 florian florian 15381770 2009-04-19 18:17 install.log
> drwxr-xr-x  2 florian florian     4096 2009-04-19 15:38 ipython
> drwxr-xr-x 15 florian florian     4096 2009-04-19 18:17 local
> -rw-r--r--  1 florian florian     1964 2009-03-11 15:38 makefile
> -rw-r--r--  1 florian florian     8885 2009-04-19 15:38 README.txt
> -rwxr-xr-x  1 florian florian     1449 2009-03-11 15:38 sage
> -rwxr-xr-x  1 florian florian       38 2009-04-19 15:38 sage-python
> -rwxr-xr-x  1 florian florian     1513 2009-04-19 15:38 sage-README-
> osx.txt
> -rw-r--r--  1 florian florian    54456 2009-03-11 15:38 script.sage
> drwxr-xr-x  6 florian florian     4096 2009-04-19 15:38 spkg
> drwxr-xr-x  2 florian florian     4096 2009-04-19 15:38 tmp
> flor...@base:~/sage/sage-3.4$
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[sage-support] Re: sage scripts

2009-05-22 Thread Dan Drake
On Thu, 21 May 2009 at 07:27PM -0700, flori wrote:
> The following two commands work now
> 
> flor...@base:~/sage/sage-3.4$ sudo ./sage factor.sage 2006
> 2 * 17 * 59
> 
> and
> 
> flor...@base:~/sage/sage-3.4$ sudo ./sage ./factor 2006
> 2 * 17 * 59
> 
> In the second case I changed the first line of the file to
> 
> #! /path/to/sage -python
> 
> as suggested by Kevin
> 
> Nevertheless there is still the mess with the execute rights. I am a
> newbie in linux and therefore I am not sure what I am doing wrong.
> with
> 
> chmod 777 factor
> 
> I gave all right to everybody, but still if I try
> 
> flor...@base:~/sage/sage-3.4$ ./sage ./factor 2006
> [Errno 13] Permission denied: '/home/florian/.sage//temp'
> 
> Furthermore I can't start sage with the command sage I need to type
> 
> sudo ./sage

My guess is that, when using sudo to run Sage, it created the 
$HOME/.sage/temp directory which is only writable by root.

You can fix this with the chown ("change owner") command. From your home
directory, do

$ sudo chown -R florian:florian .sage

(Obviously, you have to be root to change the owner of a file from
root to someone else.) That will recursively change the owner of all the
files in the .sage directory to you. Then, don't ever run Sage using
sudo again!

Dan

-- 
---  Dan Drake 
-  KAIST Department of Mathematical Sciences
---  http://mathsci.kaist.ac.kr/~drake


signature.asc
Description: Digital signature


[sage-support] Re: sage scripts

2009-05-21 Thread flori

Thanks a lot for your replies...

The following two commands work now

flor...@base:~/sage/sage-3.4$ sudo ./sage factor.sage 2006
2 * 17 * 59

and

flor...@base:~/sage/sage-3.4$ sudo ./sage ./factor 2006
2 * 17 * 59

In the second case I changed the first line of the file to

#! /path/to/sage -python

as suggested by Kevin

Nevertheless there is still the mess with the execute rights. I am a
newbie in linux and therefore I am not sure what I am doing wrong.
with

chmod 777 factor

I gave all right to everybody, but still if I try

flor...@base:~/sage/sage-3.4$ ./sage ./factor 2006
[Errno 13] Permission denied: '/home/florian/.sage//temp'

Furthermore I can't start sage with the command sage I need to type

sudo ./sage

thank you very much
and best regards
florian

p.s.

flor...@base:~/sage/sage-3.4$ ls -l
total 15684
-rw-r--r--  1 florian florian71842 2009-04-19 15:38 COPYING.txt
drwxr-xr-x  8 florian florian 4096 2009-04-19 18:17 data
drwxr-xr-x  4 florian florian 4096 2009-04-19 17:15 devel
drwxr-xr-x 16 florian florian 4096 2009-04-19 18:02 examples
-rw-r--r--  1 florian florian  243 2009-05-22 10:20 factor
-rw-r--r--  1 florian florian  228 2009-05-22 10:17 factor~
-rw-r--r--  1 rootroot 475 2009-05-22 10:21 factor.py
-rwxr-xr-x  1 florian florian  228 2009-05-22 10:17 factor.sage
-rw-r--r--  1 florian florian  245 2009-05-22 10:14 factor.sage~
-rw-r--r--  1 florian florian   81 2009-04-19 15:38 file.txt
-rw-r--r--  1 florian florian   428348 2009-04-19 15:38 HISTORY.txt
-rw-r--r--  1 florian florian 15381770 2009-04-19 18:17 install.log
drwxr-xr-x  2 florian florian 4096 2009-04-19 15:38 ipython
drwxr-xr-x 15 florian florian 4096 2009-04-19 18:17 local
-rw-r--r--  1 florian florian 1964 2009-03-11 15:38 makefile
-rw-r--r--  1 florian florian 8885 2009-04-19 15:38 README.txt
-rwxr-xr-x  1 florian florian 1449 2009-03-11 15:38 sage
-rwxr-xr-x  1 florian florian   38 2009-04-19 15:38 sage-python
-rwxr-xr-x  1 florian florian 1513 2009-04-19 15:38 sage-README-
osx.txt
-rw-r--r--  1 florian florian54456 2009-03-11 15:38 script.sage
drwxr-xr-x  6 florian florian 4096 2009-04-19 15:38 spkg
drwxr-xr-x  2 florian florian 4096 2009-04-19 15:38 tmp
flor...@base:~/sage/sage-3.4$

--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[sage-support] Re: sage scripts

2009-05-21 Thread Kevin Horton

On 21 May 2009, at 06:53, Kevin Horton wrote:

> On 21 May 2009, at 02:22, flori wrote:
>
>> I would like to write a script using sage and I just followed the
>> tutorial page 82. I copied the example
>>
>> #!/usr/bin/env sage -python
>> import sys
>> from sage.all import *
>> if len(sys.argv) != 2:
>>   print "Usage: %s "%sys.argv[0]
>>   print "Outputs the prime factorization of n."
>>   sys.exit(1)
>> print factor(sage_eval(sys.argv[1]))
>>
>> to a file which I named factor (without filetype!). I set the env.
>> variable
>>
>> export SAGE_ROOT=/home/florian/sage/sage-3.4/
>>
>> and I tried to run the scripts as explained in the tutorial...
>>
>> ./factor 2006
>>
>> the result was
>>
>> flor...@base:~/sage/sage-3.4$ sudo ./factor 2006
>> sudo: ./factor: command not found
>
>
> Is the sage executable in your PATH?

It is obviously more complicated than I thought.

I played around with your script on my machine, and I get the same  
result you do, even with sage in my PATH.  But, it works properly if I  
change the #! line in the script to point directly to sage, e.g:

#! /path/to/sage -python

I don't understand why this makes a difference.


--
Kevin Horton
Ottawa, Canada




--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[sage-support] Re: sage scripts

2009-05-21 Thread Minh Nguyen

Hi Florian,

On Thu, May 21, 2009 at 12:14 PM, flori  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 "%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 "%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
-~--~~~~--~~--~--~---



[sage-support] Re: sage scripts

2009-05-21 Thread flori

hay
the variable SAGE_ROOT is set to

export SAGE_ROOT=/home/florian/sage/sage-3.4/

and that is where my file is...
regards
florian
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[sage-support] Re: sage scripts

2009-05-21 Thread flori

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

the file content is

#!/usr/bin/env sage -python

import sys
from sage.all import *

if len(sys.argv) != 2:
print "Usage: %s "%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
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[sage-support] Re: sage scripts

2009-05-21 Thread Kevin Horton

On 21 May 2009, at 02:22, flori wrote:

> I would like to write a script using sage and I just followed the
> tutorial page 82. I copied the example
>
> #!/usr/bin/env sage -python
> import sys
> from sage.all import *
> if len(sys.argv) != 2:
>print "Usage: %s "%sys.argv[0]
>print "Outputs the prime factorization of n."
>sys.exit(1)
> print factor(sage_eval(sys.argv[1]))
>
> to a file which I named factor (without filetype!). I set the env.
> variable
>
> export SAGE_ROOT=/home/florian/sage/sage-3.4/
>
> and I tried to run the scripts as explained in the tutorial...
>
> ./factor 2006
>
> the result was
>
> flor...@base:~/sage/sage-3.4$ sudo ./factor 2006
> sudo: ./factor: command not found


Is the sage executable in your PATH?

--
Kevin Horton
Ottawa, Canada




--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---



[sage-support] Re: sage scripts

2009-05-21 Thread Harald Schilly

hi, have you set the executeable flag? what say's "ls -lah" ? and i
suppose you don't need "sudo".

h

PS: you don't have to send the message three times, i've disabled
moderation for you now ;)

On May 21, 8:22 am, flori  wrote:
> Hay all
> I would like to write a script using sage and I just followed the
> tutorial page 82. I copied the example
>
> #!/usr/bin/env sage -python
> import sys
> from sage.all import *
> if len(sys.argv) != 2:
>     print "Usage: %s "%sys.argv[0]
>     print "Outputs the prime factorization of n."
>     sys.exit(1)
> print factor(sage_eval(sys.argv[1]))
>
> to a file which I named factor (without filetype!). I set the env.
> variable
>
> export SAGE_ROOT=/home/florian/sage/sage-3.4/
>
> and I tried to run the scripts as explained in the tutorial...
>
> ./factor 2006
>
> the result was
>
> flor...@base:~/sage/sage-3.4$ sudo ./factor 2006
> sudo: ./factor: command not found
>
> flor...@base:~/sage/sage-3.4$ ls
> COPYING.txt  factor       install.log  README.txt
> script.sage
> data         factor~      ipython      sage                 spkg
> devel        file.txt     local        sage-python          tmp
> examples     HISTORY.txt  makefile     sage-README-osx.txt
> flor...@base:~/sage/sage-3.4$
>
> I am thankful for help... with best regards
> florian
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---