[sage-support] Re: Can I write a sage program and run it from command line?

2009-06-01 Thread Robert Bradshaw
On May 30, 2009, at 11:40 AM, simon.k...@uni-jena.de wrote: Dear Laurent, I think the idea is that Sage is with batteries included and should not interfere with anything that you have on your system. Namely, since Sage is rather big, it is very probable that Sage ships something that is

[sage-support] Re: Can I write a sage program and run it from command line?

2009-05-30 Thread pang
In the case where I'm using the test.sage trick, can I still import my own modules or have access to everything ? I guess the answer is Yes, isn't ? I've tried to import both sage and pygtk without success, both in python and sage console. Please tell me if you can achieve this. I guess you

[sage-support] Re: Can I write a sage program and run it from command line?

2009-05-30 Thread Tim Lahey
On May 30, 2009, at 11:10 AM, pang wrote: I've tried to import both sage and pygtk without success, both in python and sage console. Please tell me if you can achieve this. I guess you have to install the module within sage, even if it is installed in the system, but outside sage. Sage

[sage-support] Re: Can I write a sage program and run it from command line?

2009-05-30 Thread Kevin Horton
On Sat, May 30, 2009 at 11:10, pang pablo.ang...@uam.es wrote: In the case where I'm using the test.sage trick, can I still import my own modules or have access to everything ? I guess the answer is Yes, isn't ? I've tried to import both sage and pygtk without success, both in python

[sage-support] Re: Can I write a sage program and run it from command line?

2009-05-30 Thread Laurent
I've tried to import both sage and pygtk without success, both in python and sage console. Please tell me if you can achieve this. I guess you have to install the module within sage, even if it is installed in the system, but outside sage. The same here : #! /usr/bin/sage -python #

[sage-support] Re: Can I write a sage program and run it from command line?

2009-05-30 Thread simon . king
Dear Laurent, I think the idea is that Sage is with batteries included and should not interfere with anything that you have on your system. Namely, since Sage is rather big, it is very probable that Sage ships something that is already installed on your computer -- in your case, Python. So,

[sage-support] Re: Can I write a sage program and run it from command line?

2009-05-29 Thread David Joyner
You might be looking for the attach command: http://www.sagemath.org/doc/tutorial/programming.html On Thu, May 28, 2009 at 6:50 PM, Kurda Yon kurda...@yahoo.com wrote: Hi all, is it possible to write a file with a sage program (a set of sage command) and then execute the program? I tried

[sage-support] Re: Can I write a sage program and run it from command line?

2009-05-29 Thread Laurent
Sage is a python module. The following is an example which defines a class from which you can manipulate functions : - #! /usr/bin/sage -python # -*- coding: utf8 -*- from sage.all import * class MaClasse(object): def

[sage-support] Re: Can I write a sage program and run it from command line?

2009-05-29 Thread Kurda Yon
Hi Laurent, Thank you for your answer. I am trying to understand your code (I started to use sage just yesterday, so it can be a problem for me). The first 2 lines looks like you want to execute the commands in as a shell script. This assumptions is also supported by by a fact that I have to

[sage-support] Re: Can I write a sage program and run it from command line?

2009-05-29 Thread davidloeffler
Another alternative: if you call your file test.sage rather than test.py, and then do sage test.sage from the command line, it will be run as if you had typed all the corresponding commands in a Sage session, so you don't need the from sage.all import * line in Laurent's example above. David On

[sage-support] Re: Can I write a sage program and run it from command line?

2009-05-29 Thread davidloeffler
On May 29, 2:41 pm, Kurda Yon kurda...@yahoo.com wrote: But because of some reason it does not work. I create a file called test.py. I put there just one line from sage.all import * and then I execute this code as a Python program python test.py. Then I get the following:   File test.py,

[sage-support] Re: Can I write a sage program and run it from command line?

2009-05-29 Thread Kurda Yon
Great! It works. It is exactly what I needed. By the way. If I execute test.sage, sage creates a new file called sage.py. Is there a way to prevent that? On May 29, 9:45 am, davidloeffler dave.loeff...@gmail.com wrote: Another alternative: if you call your file test.sage rather than test.py,

[sage-support] Re: Can I write a sage program and run it from command line?

2009-05-29 Thread Laurent
davidloeffler ha scritto: Another alternative: if you call your file test.sage rather than test.py, and then do sage test.sage from the command line, it will be run as if you had typed all the corresponding commands in a Sage session, so you don't need the from sage.all import * line in

[sage-support] Re: Can I write a sage program and run it from command line?

2009-05-29 Thread William Stein
On Fri, May 29, 2009 at 7:03 AM, Laurent moky.m...@gmail.com wrote: davidloeffler ha scritto: Another alternative: if you call your file test.sage rather than test.py, and then do sage test.sage from the command line, it will be run as if you had typed all the corresponding commands in a