Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!news.roellig-ltd.de!open-news-network.org!border2.nntp.ams1.giganews.com!nntp.giganews.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!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.022 X-Spam-Evidence: '*H*': 0.96; '*S*': 0.00; 'subject:Python': 0.05; 'redirected': 0.07; 'stdout': 0.09; 'subject:process': 0.09; 'skip:p 40': 0.15; '"hello': 0.16; 'proc': 0.16; 'true:': 0.16; 'input': 0.18; 'thanks,': 0.19; 'pipe': 0.22; 'kevin': 0.23; '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; 'received:google.com': 0.34; 'message-id:@gmail.com': 0.35; 'to:addr:python-list': 0.35; 'but': 0.36; 'created': 0.36; 'child': 0.36; 'hi,': 0.37; 'skip:p 20': 0.38; 'to:addr:python.org': 0.39; 'some': 0.40; 'reply- to:addr:gmail.com': 0.77; 'header:Reply-to:1': 0.78; 'header :Return-Path:2': 0.84; 'snapshot': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:to:from:reply-to:subject:message-id:mime-version :content-transfer-encoding:content-type; bh=ESrpIq4wPu0XA3jmUazHMxckzoL8um9Nk3V2feYCYAo=; b=0/yXG/y1eePpIiY1PX4rDQI7E/gKXSH0ydZ+vXWZc7GlTaYM5AwcE/7BpPdqSHin5+ YZ2B7gAcpvk1NEhI5AkmDq5CtQM7gkLd5SadCh7DODZfnvh5GXQain9Ps0EWqBKcZyCG tAWtB1Fq7EgurLAbDoN3SolE/2Am7kx2wgSOAodxxauW7DT2/X06yorFc7sr4FiuU6u+ nZmWcoWLn/3wwS1Q8U4a0UPGvOBIfXN2GBEs5JdlBFnE7EV2NOL51asORVJNlpsVqwFH HGoEL7mKQm13D7YVHKIsnCsMi8nv1H8GsMZkGpdtI4uJ4GtGILc9dVTl8+AoXiRsyYLX /yiQ== X-Received: by 10.69.17.130 with SMTP id ge2mr13464150pbd.75.1432894674500; Fri, 29 May 2015 03:17:54 -0700 (PDT) Date: Fri, 29 May 2015 10:17:52 +0000 To: python-list@python.org From: Kevin Peterson Reply-to: Kevin Peterson Subject: stdout of child process as an input of another thread in Python? X-Priority: 3 X-Mailer: CatPHPMailer 5.1 (phpmailer.sourceforge.net) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ 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: 21 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1432894677 news.xs4all.nl 2847 [2001:888:2000:d::a6]:53714 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:91443 Hi, 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. Thanks, Kevin Peterson