I have two threads which are calling a function and that function is creating one more thread.
def run(urls):
while len(urls) != 0:
t3 = threading.Thread(target=scrap_matches, args=(urls[-1],))
try:
print("URL left", threading.currentThread().getName(), len(urls))
t3.start()
del urls[-1]
except:
print("Got Exception")
part_1, part_2 = parse(urls)
print(part_1)
print(part_2)
t1 = threading.Thread(target=run, args=(part_1,))
t2 = threading.Thread(target=run, args=(part_2,))
t1.start()
t2.start()
t1.join()
t2.join()
part_1 and part_2 are lists. When I got exception in function scrap_matches then instead of catching exception, thread breaks. I have searched a lot and I find few solutions but those are out of scope of my knowledge.