spawning a process with subprocess

Thomas Bellman bellman at lysator.liu.se
Tue Nov 27 13:07:19 EST 2007


bhunter <brian.p.hunter at gmail.com> wrote:

> * The problem with the testcase, I believe, was the size of the file
> and the output pipe filling up, as Nick suggested.  When run on a
> smaller file, with Jordan's suggestions, it works fine.  With a larger
> file, it's necessary to do as Nick says.  If the size of the file is
> unknown, its best to use this case as the default.  This seems
> unfortunate to me, because it's quite a bit of code to do something
> that should be fairly straightforward--at least, that's what I think.

You may be interrested in the module 'asyncproc', which I wrote
a couple of years ago to make it easier working with processes
that would otherwise block on output.  You can download it at
<http://www.lysator.liu.se/~bellman/download/asyncproc.py>.

It probably only works on Unix, but considering your use of "cat"
as a test program, I suppose that isn't a problem for you.


-- 
Thomas Bellman,   Lysator Computer Club,   Linköping University,  Sweden
"God is real, but Jesus is an integer."      !  bellman @ lysator.liu.se
                                             !  Make Love -- Nicht Wahr!



More information about the Python-list mailing list