Running program in background

jurgen.defurne at philips.com jurgen.defurne at philips.com
Thu Jan 25 02:43:37 EST 2001


Under Windows you have two options :
- Use Cygwin to build Python, and then you have fork and exec
- Use Python for Windows, then you must use the spawn calls

Unfortunately, the spawn calls are not completely documented in the Python manuals.
Thanks to the fact that we have MSDN here, I can tell you more.

First, contrary to what the manual says, the following functions are implemented in module
'os':
	- spawnl
	- spawnle
	-spawnv
	-spawnve
The 'spawnl' calls take a variable number of arguments, the 'spawnv' calls take a list
or tuple for arguments.

Usage :
	spawnl[e](options, program, arg0, arg1, ....)
	spawnv[e](options, program, argument_list)

The first argument for program must be the name of the program itself, and then
must the real arguments of the program follow.

Example :
	spawnl(os.P_DETACH, 'd:\\python20\\python', 'python', 'script.py')

If you use the option os.P_DETACH, then you can kill the parent process.

There is no real parent-child relationship between spawning and spawned
processes.

Hopes this helps,

Jurgen




m.j.fisher at ex.ac.uk@SMTP at python.org on 24/01/2001 19:50:36
Sent by:	python-list-admin at python.org
To:	python-list at python.org@SMTP
cc:	 
Subject:	Running program in background
Classification:	

Hello,

I am building a program for use on Windows and Linux and I don't want
the user to have it on their taskbar all the time getting in their way,
my problem is that I don't know how to run a program in the background
on Windows, I have used os.fork on Linux but this doesn't work on
Windows....

Thanks in advance :-)

Shelley

--
http://mail.python.org/mailman/listinfo/python-list






More information about the Python-list mailing list