[IPython-dev] Starting an IPython cluster from within a Python script

Bradley M. Froehle brad.froehle at gmail.com
Wed Sep 12 13:37:59 EDT 2012

Try using the subprocess module.  For example:

import subprocess
child = subprocess.Popen("ipcluster start -n 6", shell=True)

You can read the help for information on how to avoid printing output
from the script, waiting for the process to complete, etc.

import os
import subprocess
devnull = open(os.devnull, 'w')
child = subprocess.Popen(['ipcluster', 'start', '-n', '6'], stdout=devnull)


On Wed, Sep 12, 2012 at 10:17 AM, Michael Bilow
<michael.k.bilow at gmail.com> wrote:
> Quick question:
> When I try to start an IPython cluster from a python script, for example,
> using os.system("ipcluster start -n 6"), the process just seems to hang.  I
> think this is because the process is waiting for a return value from the
> call to os.system, which never comes.  Starting an ipcluster in another
> shell window works fine.  Is there a way (or is it not recommended) to start
> ipclusters within a Python script?
> Thanks!
> Michael
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev

More information about the IPython-dev mailing list