windows background process

Podi podi.ex at gmail.com
Wed Nov 22 19:27:57 EST 2006


Hi,

I am using Python 2.4.4 on Windows XP SP2.

I am trying to start a process (infinite loop application) in the
background and I've tried several options and none of them seem to
work.

Any help would be much appreciated.

Thanks,
P

1.
# This works on PythonWin interactive window, but the python.exe
process hangs until mycmd.exe process dies
>>> os.popen("mycmd.exe myargs")  # works

if __name__ == '__main__':
    os.popen("mycmd.exe myargs")  # hangs

2.

>>> os.system("mycmd.exe myargs")  # hangs, as expected

3.
os.spawnl(os.P_NOWAIT, 'mycmd.exe', 'myargs') # mycmd.exe not started
os.spawnv(os.P_NOWAIT, 'mycmd.exe', tuple('myargs')) # mycmd.exe not
started

4.
# Works, but not portable. My code is expected to run on *nix later on
os.system('start /B "dummy title" "mycmd.exe" myargs')




More information about the Python-list mailing list