[Tutor] Re: How to launch multiple processes from script?
andre1 at yandex.ru
Mon Dec 13 20:23:01 CET 2004
> I'm working my way through the sockets module. To test my simple
> server and clients, I'd like a way to launch the server and multiple
> clients from one script or batch file,all running simultaneously. Each
> server/client should run as it's own process and have a console
> window. I've briefly played with spawn and forkpty with no success.
> Running WinXP right now.
> I am hoping that there is something as simple as this psuedo code:
> for i in range(1..10):
> run_with_console("client.py " + arg0[i] +" " +arg1[i])
> My question is what is pythonese for run_with_console?
There is a Windows command called 'start' which will start an application
and then exit. So you can do the required thing this way:
for i in range(10):
os.system("start python client.py " + arg0[i] + " " + arg1[i])
On my system it works just the way you want.
More information about the Tutor