Python Forum
Thread Rating:
  • 2 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
thread pool
#5
I ran the code and got:

Traceback (most recent call last):
File "C:\Users\frankie\AppData\Local\Programs\Python\Python36-32\test3.py", line 28, in <module>
r = A.compute(10)
File "C:\Users\frankie\AppData\Local\Programs\Python\Python36-32\test3.py", line 22, in compute
print ([res.get(timeout=1) for res in result])
File "C:\Users\frankie\AppData\Local\Programs\Python\Python36-32\test3.py", line 22, in <listcomp>
print ([res.get(timeout=1) for res in result])
File "C:\Users\frankie\AppData\Local\Programs\Python\Python36-32\lib\multiprocessing\pool.py", line 604, in get
raise TimeoutError
multiprocessing.context.TimeoutError

After I added if '__name__ == __main__': before 'A = myClass()', then I got the code being successfully compiled and the result was:

in compute()
[3, 3, 3, 3, 3, 3, 3, 3, 3, 3]
Reply


Messages In This Thread
thread pool - by Frankie - May-14-2017, 03:50 AM
RE: thread pool - by Ofnuts - May-14-2017, 07:50 PM
RE: thread pool - by Frankie - May-15-2017, 12:00 PM
RE: thread pool - by Ofnuts - May-15-2017, 09:22 PM
RE: thread pool - by Frankie - May-16-2017, 01:49 PM
RE: thread pool - by Ofnuts - May-16-2017, 09:50 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Dynamic updating of a nested dictionary in multiprocessing pool Mil_K 1 16,242 Oct-16-2018, 09:15 AM
Last Post: MaklaTakan

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020