print("* Parsing users email in parallel..")
pool = Pool(processes=NUM_PROCESSES)
for result in pool.imap_unordered(worker, usernames, chunksize = 2):
total_number_messages += result["verify_counter"]
total_number_messages_imported += result["num_imported"]
total_number_duplicates += result["duplicate_counter"]
address_book[result["current_user_email"]] = result["username"]
combined_msg_senders.append({
"counter": result["counter"],
"address": result["current_user_email"],
"username": result["username"]
})
pool.close()
pool.join()
请帮助我解决此错误,获取上述错误
Traceback (most recent call last):
File "metadata.py", line 539, in <module>
main()
File "metadata.py", line 511, in main
total_number_messages += result["verify_counter"]
TypeError: 'NoneType' object has no attribute '__getitem__'
答案 0 :(得分:2)
result
设置为None
,因此result[...]
失败。
result
返回None
,则 worker()
为None
。确保您的员工始终返回结果,或首先明确测试result is not None
。