Fix the name of the exception when queue is empty.

This commit is contained in:
Ira Lun
2020-10-01 20:42:54 +01:00
parent d1c90a49cd
commit 14066c608a

View File

@@ -66,17 +66,17 @@ class Worker(object):
self.tqdm = tqdm
def __call__(self):
queue = self.queue
while True:
try:
# get task from queue
task = next(self.queue)
task = next(queue)
if isinstance(self.tqdm, tqdm):
self.tqdm.update(1)
# run task
task.run(self.tqdm)
else:
task.run()
except IndexError:
except StopIteration:
break