Re: [sage-support] redirecting input and output to Sage

2016-01-23 Thread Jori Mäntysalo
Quoting Luis Finotti stdbuf --output=L ./sage tmp.sage > tmp.out I was unfamiliar with stdbuf... Then maybe you don't know time, timeout, ulimit etc. either. And in some (rare) cases even "at" would be nice for some users. Actually, maybe I should write a short text for Linux commands maybe

Re: [sage-support] redirecting input and output to Sage

2016-01-23 Thread Luis Finotti
On Saturday, January 23, 2016 at 11:16:55 AM UTC-5, jori.ma...@uta.fi wrote: > > Quoting Luis Finotti >: > > > Could someone explain how redirection works with Sage (or point me in > the > > right direction)? > > I suggest to not do anything sage- or python-specific to general problem > like

Re: [sage-support] redirecting input and output to Sage

2016-01-23 Thread Jori Mäntysalo
Quoting Luis Finotti : Could someone explain how redirection works with Sage (or point me in the right direction)? I suggest to not do anything sage- or python-specific to general problem like this. Instead rely on usual tools, stdbuf in this example: stdbuf --output=L ./sage tmp.sage > tmp.o

Re: [sage-support] redirecting input and output to Sage

2016-01-23 Thread Luis Finotti
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 ou

Re: [sage-support] redirecting input and output to Sage

2016-01-23 Thread Jeroen Demeyer
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 appea

[sage-support] redirecting input and output to Sage

2016-01-22 Thread Luis Finotti
I'm having a hard time understanding how redirecting input and output works with Sage. I have a file, tmp.sage, with the following content: import time for i in range(6): print i time.sleep(10) If I start sage and issue "load('tmp.sage')", it runs as expected. If I do sage < tmp.sage >