Run two processes in parallel

Thorsten Kampe thorsten at thorstenkampe.de
Sun Mar 29 07:39:52 EDT 2015


* Ian Kelly (Sun, 29 Mar 2015 03:13:31 -0600)
> 
> On Sun, Mar 29, 2015 at 2:11 AM, Thorsten Kampe
> <thorsten at thorstenkampe.de> wrote:
> >
> > I'd like to run two processes concurrently (either through a builtin
> > module or a third-party). One is a "background" task and the other is
> > displaying a spinner (for which I already found good packages).
> > [...]
> 
> It shouldn't be all that complicated:
> 
> import time, multiprocessing, spinner
> process1 = multiprocessing.Process(target=time.sleep, args=(60,))
> process1.start()
> [...]

Thanks, I missed the example in the long documentation for 
multiprocessing. From Python 3.2 there is also `concurrent.futures` 
which does the same thing - but also allows you to use a thread.

Thorsten




More information about the Python-list mailing list