[Numpy-discussion] Simple way to launch python processes?

Olivier Delalleau shish at keba.be
Wed Dec 7 15:43:27 EST 2011


Maybe try stackoverflow, since this isn't really a numpy question.
To run a command like "python myscript.py arg1 arg2" in a separate process,
you can do:
    p = subprocess.Popen("python myscript.py arg1 arg2".split())
You can launch many of these, and if you want to know if a process p is
over, you can call p.poll().
I'm sure there are other (and better) options though.

-=- Olivier

2011/12/7 Lou Pecora <lou_boog2000 at yahoo.com>

> I would like to launch python modules or functions (I don't know which is
> easier to do, modules or functions) in separate Terminal windows so I can
> see the output from each as they execute.  I need to be able to pass each
> module or function a set of parameters.  I would like to do this from a
> python script already running in a Terminal window.  In other words, I'd
> start up a "master" script and it would launch, say, three processes using
> another module or a function with different parameter values for each
> launch and each would run independently in its own Terminal window so
> stdout from each process would go to it's own respective window.  When the
> process terminated the window would remain open.
>
> I've begun to look at subprocess modules, etc., but that's pretty
> confusing. I can do what I say above manually, but it's gotten clumsy as I
> want to run eventually in 12 cores.
>
> I have a Mac Pro running Mac OS X 10.6.
>
> If there is a better forum to ask this question, please let me know.
>
> Thanks for any advice.
>
>
> -- Lou Pecora, my views are my own.
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20111207/18940239/attachment.html>


More information about the NumPy-Discussion mailing list