> Sounds interesting, but I'm not familiar with threading (not that I > wouldn't be willing to learn). > Is it even possible to pipe into a running process, though?
You create the pipe to the process when you start it. e.g. subprocess.Popen(['ls', 'foo'], stdout=subprocess.PIPE, stdin=subprocess.PIPE) Irmen de Jong mentions the multiprocessing module, that might be a better approach. I don't use it for production purposes because it has bad properties when processes are killed abruptly (it can't tell necessarily the difference between a truncated message and a normal message). It doesn't feel safe, you know? (Of course, neither do threads!) Devin On Wed, Nov 30, 2011 at 5:19 PM, Andrew Berg <bahamutzero8...@gmail.com> wrote: > On 11/30/2011 3:32 PM, Devin Jeanpierre wrote: >> You could also use threads and pipes. (I'm not actually >> sure how threads+pipes works, but I'm told that it's a viable >> approach). > Sounds interesting, but I'm not familiar with threading (not that I > wouldn't be willing to learn). > Is it even possible to pipe into a running process, though? > >> For what it's worth, I wrote something potentially similar using Twisted >> and AMP. AMP is an Asynchronous Messaging Protocol: this basically >> means that clients and servers can send messages to each other at any >> time in any order. Twisted makes sure that the right response gets >> associated with the right message. This can be very convenient -- you >> might request something from another process, and then to compute its >> answer it might ask for some additional information from you, and then >> you give it that information, and it sends back the final result. >> >> All the communication is done over TCP, usually using Twisted. So this >> does involve bringing in a fairly large dependency. > Sounds like overkill, but I'll take a look. > > -- > CPython 3.2.2 | Windows NT 6.1.7601.17640 | Thunderbird 7.0 > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list