6

I am writing a code to run pool executor and use a function with two arguments.

    args=[(0,users[0]),(1,users[1]),(2,users[2]),(3,users[3]),(4,users[4]),(5,users[5]),(6,users[6])]

    if __name__ == '__main__':
        with concurrent.futures.ThreadPoolExecutor() as executor:
            results=[executor.submit(do_all,(a,b)) for (a,b) in args]
        
            for result in concurrent.futures.as_completed(results):
                print(result)`

I think the problem here is in the unpacking, but I couldn't do it with all trials

Please need support

I need to run it as expected

2
  • 3
    You need executor.submit(do_all,a,b) instead of executor.submit(do_all,(a,b)). Commented Dec 29, 2022 at 13:23
  • @MisterMiyagi really thank you very much, it solved that issue Commented Dec 29, 2022 at 16:33

1 Answer 1

10

You need executor.submit(do_all,a,b) instead of executor.submit(do_all,(a,b)), as stated by MisterMiyagi.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.