On Wed, 27 May 2009 at 07:01PM -0700, Baruch wrote: > Please note that I am a complete noob here. I've tried to find the > answer myself, but don't know quite where to turn. > > I wanted to save the output of a brief script. I used the logstart > instruction, 'logstart -o filename'. This seemed to give me what I > wanted - the response to this instruction was: > > Activating auto-logging, Current session state plus future input > saved. > Filename : filename > Mode : backup > Output logging : true > Raw input logging : false > Timestamping : false > State : active > > Despite this, 'filename' contained only the input, not the output. > > Is there some way to save output, for example by printing it to a > file?
If you want to save the output of a script, you can just use shell redirection: $ sage foo.sage > output.txt or, to see the output and also put it in the file, $ sage foo.sage | tee output.txt You can also, from within your script, write strings to a file: see http://docs.python.org/tutorial/inputoutput.html#reading-and-writing-files. From an interactive command-line session, see log_text, log_dvi, and log_html, although I just tested log_text and for some reason it's not putting the output into the log...log_dvi works, though. Dan -- --- Dan Drake <dr...@kaist.edu> ----- KAIST Department of Mathematical Sciences ------- http://mathsci.kaist.ac.kr/~drake
signature.asc
Description: Digital signature