interpreter in the background

Andrea Tomadin tom.and at tiscalinet.it
Sat Jul 28 07:29:38 EDT 2007


Hi,
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
2

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!

Best,
Andrea

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2425 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20070728/c4ba8a88/attachment.bin>


More information about the Python-list mailing list