[Python-Dev] A better popen2

P at draigBrady.com P at draigBrady.com
Thu Jun 24 15:16:25 EDT 2004

I've written a couple of apps that required
running a command and grabbing the output,
and I've found the existing interfaces problematic for this.

I think the proliferation of functions and classes
in the popen2 module illustrates the problem
Now if I want to read both stdout and stderr
seperately then it's awkward to say the least
to implement that without deadlocking using
the popen2 module. Also the multiplexing of
stdout and stderr in popen4 and commands.getoutput
is not usually what one requires IMHO.

There are external solutions like the getCommandOutput recipe:
which has problems that I've commented on there.
There are also very complex solutions like "subproc" from
Ken Manheimer and "task" from Rob Hooft

Therefore I bit the bullet and wrote my own,
with as simple an interface as I thought possible:

Perhaps this could be included in commands.py for e.g.?

Any comments appreciated.


p.s. sorry about the previous case of trigger finger

More information about the Python-Dev mailing list