Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #26319

Re: Pass data to a subprocess

Path csiph.com!usenet.pasdenom.info!news.albasani.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <andrea.crotti.0@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.037
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'nasty': 0.07; 'structure,': 0.09; 'thread,': 0.09; 'cc:addr:python-list': 0.10; 'anyway': 0.11; 'add,': 0.16; 'pipes': 0.16; 'module': 0.19; 'all,': 0.21; 'cc:2**0': 0.23; 'elements': 0.23; 'this:': 0.23; 'seems': 0.23; 'cc:no real name:2**0': 0.24; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'wrote': 0.26; 'wonder': 0.27; 'mix': 0.27; 'message-id:@mail.gmail.com': 0.27; 'surprised': 0.29; 'yes.': 0.29; 'url:mailman': 0.29; 'worked': 0.30; 'basic': 0.30; 'code': 0.31; 'url:python': 0.32; 'running': 0.32; 'url:listinfo': 0.32; 'subject:data': 0.33; 'another': 0.33; "can't": 0.34; 'received:google.com': 0.34; 'expected': 0.35; 'posting': 0.35; "won't": 0.35; 'received:209.85': 0.35; 'but': 0.36; 'url:org': 0.36; 'url:library': 0.36; 'communicate': 0.37; 'received:209': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'things': 0.38; 'url:docs': 0.38; 'header:Received:5': 0.40; 'url:mail': 0.40; 'think': 0.40; 'safe': 0.63; 'more': 0.63; 'talking': 0.66; 'actually,': 0.84; 'child,': 0.84; 'nagy': 0.84; 'start.': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Vw4foLZvY8yg99lG+RdyNgjPtq0Fb/yIjvecYk3wOuM=; b=q5ghSr/VuDjftwEA7+98Mt7uVpSUCuQTjATWkBGYGGr/coYiHB8jc9k6rDCLSU2/fu rpl2Slbk3JxvdPutGhwe+AHJfov8niij2rtRNPwJdxkbq9TIHTVYGS1kYAq6WtQ/m7Lo 9ZL2DaT6AWteoVW7Y18dyjwZTqwMsCvYfb5/EePTNK6nnvyVKZCopQC1L/qrd6/q9jyU 4zb37y67gL/XQQrXBh0Ii9S8PkXkKt3ItcSG4emu36miTF/agfbig09zK5mwmwPyRowZ OnMuHArjgmMrowCnaYGIWaGt/XJLwjeb+fwZ3+7Mt4sWiVecvi1SBHGoXGGUhphnM7DK /r4A==
MIME-Version 1.0
In-Reply-To <5017EFB0.6080608@shopzeus.com>
References <CAF_E5JY5FgEJub7tNNzZEj0tri8Z7oPZUSLOLtD+5f0t7Yv+Yg@mail.gmail.com> <CAF_E5JY2sEsauXM-teW4hTHePqFCYK6z+9oLMZcjVWFyYs+gKg@mail.gmail.com> <5017EFB0.6080608@shopzeus.com>
Date Tue, 31 Jul 2012 16:26:18 +0100
Subject Re: Pass data to a subprocess
From andrea crotti <andrea.crotti.0@gmail.com>
To Laszlo Nagy <gandalf@shopzeus.com>
Content-Type text/plain; charset=ISO-8859-1
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2788.1343748380.4697.python-list@python.org> (permalink)
Lines 31
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1343748380 news.xs4all.nl 6962 [2001:888:2000:d::a6]:43035
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:26319

Show key headers only | View raw


2012/7/31 Laszlo Nagy <gandalf@shopzeus.com>:
>> I think I got it now, if I already just mix the start before another add,
>> inside the Process.run it won't see the new data that has been added after
>> the start. So this way is perfectly safe only until the process is launched,
>> if it's running I need to use some multiprocess-aware data structure, is
>> that correct?
>
> Yes. Read this:
>
> http://docs.python.org/library/multiprocessing.html#exchanging-objects-between-processes
>
> You can use Queues and Pipes. Actually, these are basic elements of the
> multiprocessing module and they are well documented. I wonder if you read
> the documentation at all, before posting questions here.
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list


As I wrote "I found many nice things (Pipe, Manager and so on), but
actually even
this seems to work:" yes I did read the documentation.

I was just surprised that it worked better than I expected even
without Pipes and Queues, but now I understand why..

Anyway now I would like to be able to detach subprocesses to avoid the
nasty code reloading that I was talking about in another thread, but
things get more tricky, because I can't use queues and pipes to
communicate with a running process that it's noit my child, correct?

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Pass data to a subprocess andrea crotti <andrea.crotti.0@gmail.com> - 2012-07-31 16:26 +0100

csiph-web