open2 problem
mapik.ua at gmail.com
mapik.ua at gmail.com
Fri Mar 10 07:49:26 EST 2006
Hi. I have such problem with os.popen2 function:
//test.py file
#!/usr/local/bin/python
print "start"
x= raw_input()
print "end"
//main.py file
#!/usr/local/bin/python
import os
i,o = os.popen2('./tester.py')
print o.readline()
i.write("hi")
print o.readline()
i.close()
o.close()
When I run main.py its hung so I break it running and get exception
error:
Traceback (most recent call last):
File "./tester.py", line 4, in ?
x= raw_input()
Traceback (most recent call last):
KeyboardInterrupt
File "./c.py", line 5, in ?
print o.readline()
KeyboardInterrupt
But if I in main.py make some changes its work fine, but i need to read
first line for analyzing:
//main.py file
#!/usr/local/bin/python
import os
i,o = os.popen2('./tester.py')
i.write("hi")
print o.readline()
print o.readline()
i.close()
o.close()
More information about the Python-list
mailing list