interpreter in the background
tom.and at tiscalinet.it
Sat Jul 28 13:29:38 CEST 2007
I need to use the Python interpreter as if it were a Matlab or
Mathematica "kernel", i.e. running in the background while I use an
interface program to send commands and get output.
Ideally, I would pipe some text "to" the interpreter (through a fifo,
a socket...?) and got all the output back to the calling program, or
appended to a text file, etc. Say:
# cat pythonInput.txt
1 + 1
# cat pythonInput.txt | myInterface > pythonOutput.txt
# cat pythonOutput.txt
or similar. Note that I need the *same* interpreter to run between
consecutive calls of myInterface, to preserve the memory stack.
Moreover, if I run a python script in the background, and not the
bare interpreter, an input error could force the termination of the
program, while I want the background "kernel" to keep up running.
At first I thought it was a trivial task, just change default input
and output instead of tty, but I could not find out a solution!
Any help or hint is greatly appreciated!
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 2425 bytes
Desc: not available
More information about the Python-list