我用
threading.Thread(target=ftp1.ftptester, args=[self.finallist], daemon=False).start()
为了处理文件列表,可能需要长达 3 分钟才能完成 ftptester 函数,下面的代码只需在完成我尝试过的线程后执行
kl=threading.Thread(target=ftp1.ftptester, args=[self.finallist], daemon=False).start()
kl.join()
但是它给了我错误
AttributeError: 'NoneType' object has no attribute 'join'
注意*线程是从 asyncio ->eventloop-> run_until_complete 调用的
最佳答案
因为你在最后调用了 start 并且 start 返回了一个 none 类型,你实际上已经清除了你的 kl 变量。这应该可以修复它。
kl=threading.Thread(target=ftp1.ftptester, args=[self.finallist], daemon=False)
k1.start()
kl.join()
关于python - 我怎样才能等到线程完成其进程?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47417436/