win32: popen works, popen3 causes hang
David Bolen
db3l at fitlinxx.com
Wed Jun 5 20:22:36 EDT 2002
"G. Willoughby" <never at mind.info> writes:
> i think os.popen3 returns a tuple of file objects, so to use this command
> correctly it should be coded like this:
>
> childstdin, childstdout, childstderr = os.popen3("spectrum.exe -file
> script.tcl")
How you store the results really doesn't matter. In your example,
you're doing tuple unpacking, which I agree is generally convenient
and provides a simple way to name elements of the tuple, but there's
nothing "wrong" with just binding a name to the tuple itself. E.g.,
output = os.popen3("spectrum.exe -file script.tcl")
is just fine - output is just a tuple in that case.
> to read the error stream use childstderr.read() etc..
The equivalent to that would then be output[2].read().
--
-- David
--
/-----------------------------------------------------------------------\
\ David Bolen \ E-mail: db3l at fitlinxx.com /
| FitLinxx, Inc. \ Phone: (203) 708-5192 |
/ 860 Canal Street, Stamford, CT 06902 \ Fax: (203) 316-5150 \
\-----------------------------------------------------------------------/
More information about the Python-list
mailing list