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


Groups > comp.lang.python > #31632

Watching output and put back in background

Date 2012-10-18 14:05 +0100
Subject Watching output and put back in background
From andrea crotti <andrea.crotti.0@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.2428.1350565561.27098.python-list@python.org> (permalink)

Show all headers | View raw


In one process I need to run many quite weird shell commands that take a
long time, possibly in parallel.

Now the problem is that I need to catpure the initial standard error of
the command and then I can go on with the second one, but how can I do
that?

It should be something like

Popen(long_command..)

- first line output
- second line
- interesting line

.. more things ..

But if I just do

out, err = proc.communicate()

it will hang there until the end, right?

Maybe a solution would be to redirect the stderr to file and watch that
instead..

Or otherwise I could use a thread for each shell command, but I would
like to avoid head-aches with possible race-conditions..

Ideas?

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


Thread

Watching output and put back in background andrea crotti <andrea.crotti.0@gmail.com> - 2012-10-18 14:05 +0100
  Re: Watching output and put back in background Nobody <nobody@nowhere.com> - 2012-10-19 15:22 +0100

csiph-web