I found this thread which was over 2 years old. I wanted to ask a new question so I could get more attention
My question:
I have the same situation as @DavidJB as he describes in one of his comments in the earlier post
Thanks, this appears to work, however when I include a While loop in slave.py it seems get stuck and not perform anything in the loop (even with a timer.sleep() function..? – DavidJB Apr 17 '13 at 23:59
Anyone has any updates on this?
I want the child(slave.py), which has the while loop, to keep running and the parent(main.py) to not wait on the child to end. The parent should continue it's working.
This is how my main and child would look like.
main.py
...
proc = Popen('child.py', stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True)
out, err = proc.communicate()
...
In main, I want to spwan off the child.py and go do other stuff after spawning it off
child.py
while True:
file = open( '/mnt/flash/child.txt', 'aw' )
file.write( datetime.now().strftime('%Y-%m-%d %H:%M:%S') + "\t\topened the file now!!\thi\n" )
time.sleep(5)
...
<break>
file.close()
The child, once started, writes into a file, the current time every 5 seconds unless some event breaks it out of the infinite loop