win32: popen works, popen3 causes hang

G. Willoughby never at mind.info
Wed Jun 5 20:04:26 EDT 2002


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")

to read the error stream use childstderr.read() etc..

--G. Willoughby

"Alex Eggenberger" <eggy at island.net> wrote in message
news:930dfcf0.0205301058.6917c599 at posting.google.com...
> I am trying to launch a program called leonardo spectrum from python
> and retrieve the stdout and stderr that results.  spectrum.exe is
> strictly command line under win32.  Here is what I have encountered:
>
> launching spectrum.exe using the following call:
> output = os.popen('spectrum.exe -file script.tcl')
>
> The result is as expected, the program runs and I use output.read() to
> get stdout.  I need some info from stderr.  So I would like to use
> popen3 like this:
> output = os.popen3('spectrum.exe -file script.tcl')
>
> This causes spectrum.exe to hang.  I can tell it is hung on
> spectrum.exe because I can see the process persists indefinitely in
> Task Manager.
>
> Is there a difference in the popen and popen3 operate that could be
> causing this problem.  Everything else except the popen call is
> identical in the two cases.
>
> Any help or suggestions would be appreciated.
>
> Alex





More information about the Python-list mailing list