Simple process IO capture (Was: "shell-commands" and python!) - process.py (0/1)

Paul Moore gustav at morpheus.demon.co.uk
Tue Sep 25 23:25:34 CEST 2001


On Mon, 24 Sep 2001 16:38:29 -0400 (EDT), Ignacio Vazquez-Abrams
<ignacio at openservices.net> wrote:

>On Mon, 24 Sep 2001, Paul Moore wrote:
>
>How about these changes:
[...]
>with those changes you can use proocess.retval instead of process.retval()
>(not a big change, but why have extra code?), and you can get the return code
>from the exception more easily.

Yes, I like those. I originally had a retval variable rather than a retval()
function, but I changed as a function is read-only where a variable is
read-write. But that's probably excessive paranoia.

>In fact, you may also want to default the run() function to raising an
>exception rather than just setting retval; force the user to have to
>explicitly override the Pythonic behaviour.

Probably. I worried about programs like diff() which return a non-zero exit code
to signal differences, even though differences specifically *aren't* errors...

But you have some good points.

Paul.



More information about the Python-list mailing list