我有以下帖子
thread = threading.Thread(target=editing, args=(values['_CHECK_'], files, directory, window, progress_bar,), daemon=True).start()并希望检查线程是否仍在运行。
if not thread.is_alive()
pass或
if not thread.isAlive():
pass两者都不起作用。为什么?
例外:
File "Progress.py", line 101, in progress
if not thread.isAlive():
AttributeError: 'NoneType' object has no attribute 'isAlive'发布于 2021-09-14 16:59:05
这是因为start() just Start the thread’s活动并返回None。你可能缩进到写下
>>> thread = threading.Thread(target=editing, args=(values['_CHECK_'], files, directory, window, progress_bar,), daemon=True)
>>> thread.start() # start the thread
>>> is_alive = thread.is_alive()
>>> print(is_alive)https://stackoverflow.com/questions/69181692
复制相似问题