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


Groups > comp.lang.python > #91443

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

Date 2015-05-29 10:17 +0000
From Kevin Peterson <qh.resu01@gmail.com>
Subject stdout of child process as an input of another thread in Python?
Newsgroups comp.lang.python
Message-ID <mailman.170.1432894677.5151.python-list@python.org> (permalink)

Show all headers | View raw


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

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


Thread

stdout of child process as an input of another thread in Python? Kevin Peterson <qh.resu01@gmail.com> - 2015-05-29 10:17 +0000

csiph-web