
mal wrote:
BTW, (pardon my ignorance) what is the most portable way to do the equivalent of a os.system("cmd &") as native OS API call ? [On Unix, "cmd &" starts a new process which runs in the background and detached from the calling process.]
I've looked at .execve and .spawnve, but they both replace the current process.
on windows, spawn(P_NOWAIT) does what you want. here's an example from the eff-bot guide: # # os-spawn-example-2.py import os import string def run(program, *args, **kw): # find executable mode = kw.get("mode", os.P_WAIT) for path in string.split(os.environ["PATH"], os.pathsep): file = os.path.join(path, program) + ".exe" try: return os.spawnv(mode, file, (file,) + args) except os.error: pass raise os.error, "cannot find executable" run("python", "hello.py", mode=os.P_NOWAIT) </F>