ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 26 Nov 2019 01:03:50 +0100Grabbing Output in Linuxhttps://ask.sagemath.org/question/48884/grabbing-output-in-linux/Hello!
I have a great deal of code written in Pascal, and this code runs on a linux terminal. Currently, the only way I can run sage math through this program is to do the following: type a list of commands to run in sage as a concatenated strings separated by semicolons, and I then write the output to a textfile. For example 'load(''whatever'');function_call(something);... > sometextfile.txt'. This entire line is written in a call to the terminal. Effectively what is fed is *sage -c that-string*. The problem with this method is it adds time because sage has to open and close every time it runs. Is there a command in sage that allows me to keep the sage terminal persistent and I then ping that terminal with new commands. I assume the way to ping with new commands is to pipe from one terminal to the one running sage, but I am not a unix connisseur.
Of course, the easiest method is to run my code via python and have python run the pascal code. This is, unfortunately, not an option.KraigTue, 26 Nov 2019 01:03:50 +0100https://ask.sagemath.org/question/48884/Using SageMath in a Unix pipe without creating fileshttps://ask.sagemath.org/question/33612/using-sagemath-in-a-unix-pipe-without-creating-files/I would like to run Sage as the middle of a Unix pipe, so that some program generates Sage input, pipes it to Sage, and another program reads the output.
$ MyProgram1 | sage | MyProgram2 > final_output
In principle, MyProgram1 will run for days, weeks or months producing hundreds of millions of inputs for Sage to process, while MyProgram2 will look out for the rare successful inputs.
I know that if I have a small amount of input, then I can create a file, say "input.sage" and then run "sage input.sage", but this creates an auxiliary file "input.sage.py" before it does anything else, and so is not suitable for hundreds of millions of inputs/outputs.GordonWed, 01 Jun 2016 10:42:13 +0200https://ask.sagemath.org/question/33612/how to run sage as a servicehttps://ask.sagemath.org/question/8598/how-to-run-sage-as-a-service/How do I run sage as a web application service (like running an instance of Ruby on Rails or a Django web application) without entering sage ipython CLI session?
Because I don't want to keep a terminal emulator like gnome terminal or x-term open,I just want to run sage in the background with log recorded in some files (say, $HOME/.local/sage/log/notebook.log). Gong-Yi LiaoWed, 28 Dec 2011 10:48:14 +0100https://ask.sagemath.org/question/8598/Calling Unix shell command as an expressionhttps://ask.sagemath.org/question/7633/calling-unix-shell-command-as-an-expression/Can I call a Unix shell command from within Sage as an expression? For example, I might want to do something like
process_local_directory_for_something(!pwd)
Unfortunately, the !-operator does _very_ weird things when used as an expression (bug?), so the above doesn't work. The os.system() does not work either (it returns the return code instead of the output). Of course, Python has options, like handling pipes or subprocesses, but for many applications this is a bit tedious.jsrnWed, 25 Aug 2010 03:31:48 +0200https://ask.sagemath.org/question/7633/