Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can do

sage slopes.sage

to run the file from the command line. The bad interaction is probably between the ipython readline interface and a non-tty stdin, not with the preparser. Note that IPython does some undesirable things for file input. For one thing, it uses auto-indent, which makes it hard or impossible to input some more complicated loops (unless you use %cpaste).

Sage or Ipython could check if stdin is a tty and revert to "file processing" (i.e., not use readline etc.) if it's not, but apparently (judging from your example) it doesn't.

In any case, the preparser does apply a few more efficient tricks (such as factoring out constants) when you use sage <file>, so it's better to use that if you can, rather than redirect the input. It has the side-effect of writing slopes.sage.py into the current directory, though.