huntermon
huntermon

Reputation: 13

How can i wait until a thread finish its process?

I use

threading.Thread(target=ftp1.ftptester, args=[self.finallist], daemon=False).start()

for processing a list of files it may take upto 3 mins to finish ftptester function the code comes below only have to execute after finishing the thread I have tried

kl=threading.Thread(target=ftp1.ftptester, args=[self.finallist], daemon=False).start()

kl.join()

But it was giving me error

AttributeError: 'NoneType' object has no attribute 'join'

Note * the thread is called from asyncio ->eventloop-> run_until_complete

Upvotes: 1

Views: 55

Answers (1)

Ajurna
Ajurna

Reputation: 561

because you have called the start at the end and start returns a none type you have essentailly cleared your kl variable. this should fix it.

kl=threading.Thread(target=ftp1.ftptester, args=[self.finallist], daemon=False)
k1.start()

kl.join()

Upvotes: 1

Related Questions