Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #75102

Re: Error in example in multiprocessing

From Terry Reedy <tjreedy@udel.edu>
Subject Re: Error in example in multiprocessing
Date 2014-07-23 19:07 -0400
References <CAEYJuZuT+75QopkshaDbxwi9oKCSXMcdGLZapyFPg3Ym9a7Fyw@mail.gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.12251.1406156885.18130.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Error in example in multiprocessing Terry Reedy <tjreedy@udel.edu> - 2014-07-23 19:07 -0400

csiph-web