R
Rajarshi Guha
Hi,
I have some code that runs an interactive program via popen3(). The program generates
output which is then used later on. My script looks like this:
o,i,e = os.popen3('/usr/local/adapt/bin/descmng -g')
o.write('\n%s\n\n' % (redpick))
o.close()
time.sleep(1)
os.system('mv set5 gendes.in && rm set? outputdesc.txt')
The program (descmng) produces the files set?, outputdesc.txt
However on some systems, the program takes more than 1 sec to complete
and as a result the os.system() command fails.
Increasing the sleep time to 5 sec solves the problem but it does'nt seem to
be reliable.
I have considered using fork() and wait() but that does'nt let me run the
program interactively.
Is there any other way out (apart from dumping commands to a file and
piping them to my program in a fork())?
Thanks,
I have some code that runs an interactive program via popen3(). The program generates
output which is then used later on. My script looks like this:
o,i,e = os.popen3('/usr/local/adapt/bin/descmng -g')
o.write('\n%s\n\n' % (redpick))
o.close()
time.sleep(1)
os.system('mv set5 gendes.in && rm set? outputdesc.txt')
The program (descmng) produces the files set?, outputdesc.txt
However on some systems, the program takes more than 1 sec to complete
and as a result the os.system() command fails.
Increasing the sleep time to 5 sec solves the problem but it does'nt seem to
be reliable.
I have considered using fork() and wait() but that does'nt let me run the
program interactively.
Is there any other way out (apart from dumping commands to a file and
piping them to my program in a fork())?
Thanks,