Thanks for the reply! On Saturday, January 23, 2016 at 4:40:00 AM UTC-5, Jeroen Demeyer wrote: > > On 2016-01-22 22:55, Luis Finotti wrote: > > sage tmp.sage >out > This should be the right way. > > > then it takes the supposed amount of time, but the "print i" is not > > redirected to file out until the loop is completely done or the script > > is done... > > You need to flush the output if you want it to appear immediately: > > http://stackoverflow.com/questions/230751/how-to-flush-output-of-python-print >
This worked. For reference, the link suggests to add: import sys and after each print statement sys.stdout.flush() As I said, it works just fine. I am a bit puzzled and concerned about the result of sage < tmp.sage > out I'm surprised that the sleep command is ignored. I have run some code that way in the past, and am not concerned that the result might be incorrect if parts of the code are ignored... It's also confusing that in those cases, the output of "print <something>" did show up in the output file, unlike the simple code above... -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.