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 > out
this script is done right away (does it ignore sleep?) and out shows:
────────────────────────────────────────────────────────────────────┐
│ SageMath Version 6.9, Release Date: 2015-10-10 │
│ Type "notebook()" for the browser-based notebook interface. │
│ Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
sage: sage: sage: sage: ....: ....: ....:
Exiting Sage (CPU time 0m0.02s, Wall time 0m0.06s).
If I do
sage tmp.sage > out
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... out shows:
0
1
2
3
4
5
Could someone explain how redirection works with Sage (or point me in the
right direction)?
--
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.