Pipe return mesage from spawnv to string?
Steve Holden
sholden at holdenweb.com
Thu Jun 6 09:55:54 EDT 2002
"Stefhan Stjärnås" <stefhan at hotmail.com> wrote in message
news:3ebec3ea.0206060443.d2cc5bb at posting.google.com...
> Hi!
>
> Anyone who knows how to pipe from spawnv?
> I start isql.exe with os.spawnv and must see the result.
>
> run ("isql.exe"," -s ....")
>
> def run (program, *args):
> """Executes program with arguments, using os.spawnv"""
> try:
> return os.spawnv(os.P_WAIT,program, (program,) +args)
> except (os.error), why:
> raise SErr, str(why)
>
Well in that case you want popen*(), not spawn*(). Whether you use popen(),
popen2(), popen3() or popen4() will depend on your needs.
if-you-need-a-pipe-then-open-one-ly y'rs - steve
-----------------------------------------------------------------------
Steve Holden http://www.holdenweb.com/
Python Web Programming http://pydish.holdenweb.com/pwp/
-----------------------------------------------------------------------
More information about the Python-list
mailing list