The output exists only in memory (RAM) until the calculation finishes,
in which case it is written to a file. Unfortunately the only way you
can ever see that full log is if Sage thinks the calculation finished.
There is exactly one hack that will give you what you want if you
do it right. If you kill the Python process that is actually doing the
calculation (which is probably taking up a lot of CPU resources),
then Sage will (probably) *think* that the calculation finished, and
write all the
output to a file and give you a link to the output. This will probably
work -- I tried testing it myself just now and it did.
But don't kill the sage notebook server by accident, since if you do that
then you'll loose all the output.
Good luck.
William
sage: logstart sage_log
Activating auto-logging. Current session state plus future input saved.
Filename : sage_log
Mode : backup
Output logging : False
Raw input log : False
Timestamping : False
State : active
sage: for n in srange(50):
....: if n.is_prime():
....: print n
....:
2
3
5
7
11
13
17
19
23
29
31
37
41
43
47
sage:
Exiting SAGE (CPU time 0m0.02s, Wall time 0m12.31s).
Then "cat sage_log" contains:
#log# Automatic Logger file. *** THIS MUST BE THE FIRST LINE ***
#log# DO NOT CHANGE THIS LINE OR THE TWO BELOW
#log# opts = Struct({'__allownew': True,
'c': '\nimport sage.misc.misc; print
sage.misc.misc.branch_current_hg_notice(sage.misc.misc.branch_current_hg());
from sage.misc.interpreter import preparser; preparser(True);import
sage.all_cmdline; sage.all_cmdline._init_cmdline(globals());from
sage.all import Integer, RealNumber;import os;
os.chdir("/home/john");import sage.misc.interpreter;from
sage.misc.interpreter import attached_files;from sage.all_cmdline
import *;_=sage.misc.interpreter.load_startup_file("/home/john/.sage//init.sage");',
'logfile': 'sage_log'})
#log# args = []
#log# It is safe to make manual edits below here.
#log#-----------------------------------------------------------------------
import sage.misc.misc; print
sage.misc.misc.branch_current_hg_notice(sage.misc.misc.branch_current_hg());
from sage.misc.interpreter import preparser; preparser(True);import
sage.all_cmdline; sage.all_cmdline._init_cmdline(globals());from
sage.all import Integer, RealNumber;import os;
os.chdir("/home/john");import sage.misc.interpreter;from
sage.misc.interpreter import attached_files;from sage.all_cmdline
import *;_=sage.misc.interpreter.load_startup_file("/home/john/.sage//init.sage");
_ip.magic("logstart sage_log")
for n in srange(Integer(50)):
if n.is_prime():
print n
(end of file) i.e. everything *except* the output. Clearly logstart
is not doing what I hoped it would (more like gp's \l (logfile)).
John
2008/7/30 kcrisman <kcri...@gmail.com>:
I'm not sure about getting partial output from the notebook (I assume it
can be done) but an easy solution is to do (from the command line)
$ sage script.sage > output_file.txt
which will execute script.sage and write the results (though possibly
buffered) to output_file.txt. You will be able to sleep without any
problem this way too--it will resume right where it left off.
- Robert