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


Groups > comp.lang.python > #91514

Re: stdout of child process as an input of another thread in Python?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!lightspeed.eweka.nl!lightspeed.eweka.nl!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.05; 'redirected': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'stdout': 0.09; 'subject:process': 0.09; 'skip:p 40': 0.15; '"hello': 0.16; 'itself).': 0.16; 'proc': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:plane.gmane.org': 0.16; 'received:t-ipconnect.de': 0.16; 'true:': 0.16; 'input': 0.18; 'pipe': 0.22; 'kevin': 0.23; 'header:User-Agent:1': 0.26; 'header:X-Complaints-To:1': 0.26; 'peterson': 0.29; 'thread,': 0.29; 'that.': 0.30; 'print': 0.31; 'skip:s 30': 0.31; 'code': 0.31; 'another': 0.34; 'subject:?': 0.34; 'to:addr:python-list': 0.35; 'but': 0.36; 'created': 0.36; '(i.e.': 0.36; 'child': 0.36; 'should': 0.37; 'subject:: ': 0.37; 'charset:us-ascii': 0.37; 'received:org': 0.38; 'skip:p 20': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:de': 0.40; 'why': 0.40; 'some': 0.40; 'your': 0.60; 'behavior': 0.61; 'received:217': 0.61; '(your': 0.84; 'snapshot': 0.84; 'suggest,': 0.84
X-Injected-Via-Gmane http://gmane.org/
To python-list@python.org
From dieter <dieter@handshake.de>
Subject Re: stdout of child process as an input of another thread in Python?
Date Sat, 30 May 2015 07:43:19 +0200
References <abcd1234abc123ab12a0000088758000010000001052@gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
X-Gmane-NNTP-Posting-Host pd9e08d15.dip0.t-ipconnect.de
User-Agent Gnus/5.1008 (Gnus v5.10.8) XEmacs/21.4.22 (linux)
Cancel-Lock sha1:f367RUc/pSRKcObPuW+9IfVt5ys=
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.214.1432964609.5151.python-list@python.org> (permalink)
Lines 23
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1432964609 news.xs4all.nl 2821 [2001:888:2000:d::a6]:49726
X-Complaints-To abuse@xs4all.nl
X-Received-Bytes 3991
X-Received-Body-CRC 837452843
Xref csiph.com comp.lang.python:91514

Show key headers only | View raw


Kevin Peterson <qh.resu01@gmail.com> writes:

> I want to use the stdout of child process as an input of another thread, but some how I am not able to read the stdout.  Using Popen I have created a child process and stdout of it I have redirected to PIPE (because I don't want that to be printed on with my main process).  Now using this statement,"Line=Proc.stdout.readline()" I want to read stdout of child process and I have to do operation on that. but somehow i am not able to read from stdout of child process. 
>
> Following is the code snapshot - 
>
>     Proc = Popen(["python.exe","filename.py"],stdout=PIPE)
>     
>     while True:
>                 Line = Proc.stdout.readline()
>                 print Line
>
> Here,
> Filename.py(Child process) is continuously printing "Hello World!!" in place of reading stdout of child process. 

Your description is not sufficiently clear:

  If "filename.py" is your child process, why should it read the stdout
  of the child process (i.e. itself).

I suggest, you describe what "filename.py" (your child) does
and what behavior you observe for the parent.

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


Thread

Re: stdout of child process as an input of another thread in Python? dieter <dieter@handshake.de> - 2015-05-30 07:43 +0200

csiph-web