Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; '(of': 0.05; 'cpython': 0.05; "(i'm": 0.09; '(it': 0.09; 'compute': 0.09; 'mentions': 0.09; 'protocol:': 0.16; 'safe,': 0.16; 'tcp,': 0.16; 'threading': 0.16; 'thunderbird': 0.16; 'truncated': 0.16; 'twisted': 0.16; 'cc:addr:python-list': 0.16; "wouldn't": 0.17; 'wed,': 0.17; 'wrote:': 0.18; 'result.': 0.21; "doesn't": 0.22; 'wrote': 0.22; 'header:In-Reply-To:1': 0.22; 'module,': 0.23; 'received:209.85.213.46': 0.23; 'received:mail- yw0-f46.google.com': 0.23; 'cc:2**0': 0.24; 'windows': 0.26; "i'm": 0.26; 'url:mailman': 0.28; 'process,': 0.28; 'message- id:@mail.gmail.com': 0.28; 'order.': 0.29; 'sends': 0.29; 'cc:addr:python.org': 0.29; 'nov': 0.29; 'pm,': 0.29; 'fairly': 0.30; 'asynchronous': 0.30; 'subject:some': 0.30; 'threads': 0.30; 'usually': 0.31; "i'll": 0.31; 'does': 0.32; 'andrew': 0.32; 'familiar': 0.32; 'url:listinfo': 0.32; "can't": 0.32; 'actually': 0.33; 'done': 0.34; 'it.': 0.34; 'message.': 0.34; 'approach.': 0.34; '(not': 0.35; 'running': 0.35; 'something': 0.35; 'response': 0.35; 'url:python': 0.36; 'similar': 0.36; 'properties': 0.36; 'convenient': 0.37; 'but': 0.37; 'received:google.com': 0.37; 'another': 0.37; 'could': 0.37; 'using': 0.38; 'purposes': 0.38; 'some': 0.38; 'received:209.85': 0.38; 'e.g.': 0.39; 'url:org': 0.39; "it's": 0.40; 'received:209': 0.40; 'might': 0.40; 'difference': 0.40; '2011': 0.61; 'course,': 0.62; 'back': 0.62; 'information,': 0.67; 'works,': 0.68; 'production': 0.71; '30,': 0.74; 'interesting,': 0.84; 'killed': 0.93; 'look.': 0.93 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=/Jf5KrKh0wvXeiyOw2eVkjCjT9ulx1W9xBqBb/tzUt0=; b=h99RgPY9S892d04iREsQbk1M7N3evxVpgRjjPuRO9WK0Cvv8U0ATel20oEm5XwTbeQ nSQLZMxwkyav8e+3JNhKhqOsmQnCBw+ZQ/xvyCSfICgWQI3vJ+Q5RaGUsfV4WfxzSs0I rJITBy2jR/LZl7Ytei37hrICTHKS3e22Slfzg= MIME-Version: 1.0 In-Reply-To: <4ED6ABFB.2040808@gmail.com> References: <4ED69A1A.3080609@gmail.com> <4ED6ABFB.2040808@gmail.com> From: Devin Jeanpierre Date: Wed, 30 Nov 2011 17:41:33 -0500 Subject: Re: Need some IPC pointers To: Andrew Berg Content-Type: text/plain; charset=UTF-8 Cc: "comp.lang.python" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 45 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1322692937 news.xs4all.nl 6982 [2001:888:2000:d::a6]:55835 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:16460 > 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 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 >