On Fri, Jan 9, 2009 at 4:27 PM, Tom <[email protected]> wrote:
>
>
> I think I may have found the source of the error, but not a
> solution.   Does Sage (or Python or unix) only save the output to disk
> in chunks of 32Kb?  By putting some simple print statements in my
> program, I do see the output being recorded in the file.   I find that
> the size of the results file gets incremented by approximately 32Kb
> each time.   In the original program, there was not much output so one
> would have to wait a long time before one would have 32Kb of output
> (unless the program ends).
>
> Carl, I also tried your solution  "nohup ./sage mytest.sage < /dev/
> null > results.txt &"  and it appears to have the same property.  No
> output for the original file, but output in 32Kb chunks with the new
> print statements inserted.  Also, the use of the name "commands.sage"
> was unfortunate.  I just chose that as it seemed like a generic name.
> My original program has a different name that wouldn't be a Sage
> command.
>
> If my guess above is correct, is there anyway to force Sage to save
> the output to the file more often (i.e. in smaller chunks)?

Use sys.stdout.flush():

w...@bsd:~/papers/current/ggz$ sage
----------------------------------------------------------------------
| Sage Version 3.2.1, Release Date: 2008-12-01                       |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
sage: import sys
sage: sys.stdout.flush()

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

Reply via email to