def main(): #f = open("availdirthree") #dirthree = f.read().strip() #f.close() dirthree = "dirthree08022014" output = subprocess.check_output(["find", dirthree + "/women/", "-name", "*.csv"]) pth_list = output.strip().split("\n") lenght = len(pth_list) val = len(pth_list)/200 mod = len(pth_list) % 200 for i in range(num_fetch_threads): worker = Process(target=main2, args=(i, enclosure_queue,)) worker.start() for l in range(val, lenght, val): pth_list2 = pth_list[:l] enclosure_queue.put(pth_list2) pth_list = pth_list[l:] print '*** Main multiproces waiting *****' #enclosure_queue.join() if mod: pass else: code7_allinone4.main(pth_list[mod:]) print '*** Done ****'
def main2(i, q): while True: pth_list2 = q.get() code7_allinone4.main(pth_list2)