Running shell programs from Python

Garry Hodgson garry at
Fri Apr 28 09:44:41 EDT 2000

Grant Edwards wrote:
> In article <390485A8.B5ADAAE9 at>, Garry Hodgson wrote:
> >Donn Cave wrote:
> >
> >> The references are mainly UNIX man pages pipe(2), fork(2), fcntl(2)
> >> (look for dup2), exec(2) and wait(2).
> >>
> >> Basically, the sequence is repeat ( open pipes, fork, close pipes )
> >> After a fork, the parent and child both have both ends of each pipe
> >> open, and it's important to close the unused "write" ends so the
> >> pipe will generate an EOF when its real writer exits.
> >
> >i've always been curious why this wasn't encapsulated as a single
> >command in the os module.  i use it infrequently enough that i always
> >need to go look the idiom, or skip it for simpler things.  seems like
> >a single command that returned a process id, and a pair of file
> >descriptors would have lots of uses.
> You mean like popen2?

well...yeah, kinda like that, except... that i'd know about.

thanks for the clue.  i needed one.

Garry Hodgson                   Every night 
garry at                a child is born
Software Innovation Services        is a Holy Night.
AT&T Labs                         - Sophia Lyon Fahs

More information about the Python-list mailing list