Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #91514 > unrolled thread
| Started by | dieter <dieter@handshake.de> |
|---|---|
| First post | 2015-05-30 07:43 +0200 |
| Last post | 2015-05-30 07:43 +0200 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: stdout of child process as an input of another thread in Python? dieter <dieter@handshake.de> - 2015-05-30 07:43 +0200
| From | dieter <dieter@handshake.de> |
|---|---|
| Date | 2015-05-30 07:43 +0200 |
| Subject | Re: stdout of child process as an input of another thread in Python? |
| Message-ID | <mailman.214.1432964609.5151.python-list@python.org> |
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 top | Article view | comp.lang.python
csiph-web