How to capture output of os.spawnv()?

Grant Edwards grante at visi.com
Wed Feb 13 22:30:10 EST 2002


In article <1013641215.358571 at yasure>, Donn Cave wrote:
> Quoth grante at visi.com (Grant Edwards):
>| I'd like to capture stdout/stderr from a program run with
>| os.spawnv().  
>|
>| I've searched through c.l.p archives, and the usual answer
>| seems to be "use popen2 et al".  I don't want to use popen
>| since it runs the program as a shell command and I don't want
>| the shell to mess with the strings I'm passing as arguments to
>| the programs.
> 
> Check it out.  Not popen, but as they say, "popen2 et al."

>From the popen2 doc page:

  "the parameter cmd is the shell command to execute"

I guess the use of the phrase "cmd is the shell command" in the
documentation led me to the conclusion that the "cmd" parameter was a shell
command.  ;)

> It will exec the command on its own, no shell, if you give it
> an argument list.  If you give it a string, it will use the
> shell.

Cool, that's news to me. Is that documented anywhere?

-- 
Grant Edwards                   grante             Yow!  Oh my GOD -- the
                                  at               SUN just fell into YANKEE
                               visi.com            STADIUM!!



More information about the Python-list mailing list