Problem with win32pipe.popen2
Gabriel Genellina
gagsl-py at yahoo.com.ar
Mon Jan 15 19:02:35 EST 2007
At Monday 15/1/2007 07:24, diego wrote:
>I'm trying to understand how popen2 works. Found in this group, that
>popen2.popen2 can cause trouble so i chose win32pipe.popen2.
>
>have a look a the listing of 2 files:
>ekmain.py:
>**************
>import win32pipe
>
>(stdin1, stdout1) = win32pipe.popen2("test1.py")
>stdin1.write("1\n")
>print stdout1.readlines() # This will print the result.
>**************
>
>test1.py:
>**************
>a=raw_input("a=")
>print "***a=",a
>print "finished!"
>**************
>
>
>i do not understand, why ekmain.py produces only following output:
>['a=']
>
>why is the stdin1.write("1\n") command ignored?
Using popen4 instead of popen2 we get stderr too, and there is a traceback:
['a=Traceback (most recent call last):\n', ' File
"C:\\TEMP\\test1.py", line 1,
in ?\n', ' a=raw_input("a=")\n', 'EOFError: EOF when reading a line\n']
Using "python test1.py" as the popen4 argument we get the expected result:
C:\TEMP>main.py
['a=***a= 1\n', 'finished!\n']
(I don't know why)
>p.s.: i working with python 2.3 on win2000.
I used 2.4 on XPSP2.
--
Gabriel Genellina
Softlab SRL
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas
More information about the Python-list
mailing list