Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import subprocess
- import os
- import pdb
- workers = 10
- ps = [subprocess.Popen(['python', 'processbf.py', str(workers), str(i)],
- stdout=subprocess.PIPE, close_fds=True) for i in range(workers)]
- try:
- os.remove("out.txt")
- except:
- pass
- mx = 0
- while workers>mx:
- for p in ps[:]:
- line = p.stdout.readline()
- if line:
- with open("out.txt", 'a') as fo:
- fo.write(line)
- else:
- mx+=1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement