Error in example in multiprocessing

Terry Reedy tjreedy at udel.edu
Wed Jul 23 19:07:43 EDT 2014


On 7/23/2014 6:27 AM, Akshay Verma wrote:
> Example under
>
>
>       17.2.1.6. Using a pool of workers
>       <https://docs.python.org/3.4/library/multiprocessing.html#using-a-pool-of-workers>
>
> Has a error. As far as I understand, The input to res sleep function
> should be List and not integer.
>
> res  =  pool.apply_async(sleep,  10)

You are correct. Running the example results in
Traceback (most recent call last):
   File "C:\Programs\Python34\lib\multiprocessing\pool.py", line 119, in 
worker
     result = (True, func(*args, **kwds))
TypeError: sleep() argument after * must be a sequence, not int

Changing 10 to [10] and the Exception is the expected TimeoutError
I am fixing this now.

-- 
Terry Jan Reedy




More information about the Python-list mailing list