Thanks a lot Alan !  both solutions work like a charm :)


On 3/5/07, Alan Gauld <[EMAIL PROTECTED]> wrote:


"learner404" <[EMAIL PROTECTED]> wrote

> I'm launching an external app through an os.system() or os.popen()
> but I
> don't want the resulting DOS window to hang-on there forever

Try using os.spawnl() instead:

>>> pid = os.spawnl(os.P_NOWAIT,r'C:\Windows\System32\notepad.exe')
>>> print pid
2834

The P_NOWAIT makes it return immediately, and no DOS box
is created.

Note that the spawn family of processes are deprecated and the
subprocess module provides equivalent functionality.

Using subprocess it looks like:

>>> pid = Popen([r'C:\Windows\System32\notepad.exe', ""]).pid

HTH,

--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to