[Tutor] Tutor Digest, Vol 37, Issue 15

Tony Cappellini cappy2112 at gmail.com
Mon Mar 5 20:43:01 CET 2007


Rename your file from .py to .pyw.
This will prevent the DOS window from appearing

Message: 6
Date: Mon, 5 Mar 2007 16:51:42 +0100
From: learner404 <learner404 at gmail.com>
Subject: [Tutor] Hiding/Killing a DOS window (from a previous
       os.system call)
To: "Tutor Python" <tutor at python.org>
Message-ID:
       <13a83ca10703050751k17310476x506b163e66ea2e3c at mail.gmail.com>
Content-Type: text/plain; charset="iso-8859-1"

Hello,

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 (my python
script is launched with pythonw):
I use a sys.exit() to kill the script who launched the external
app.Thepython script is killed, the app is launched, but the resulting
DOS window
is still there (I have the same result if I use the DOS tskill or taskkill
command to kill the script with his PID).

How could I hide/kill the resulting DOS window  from an os.sytem /
os.popenwith Python ?

Also is there a way to launch an external app. but without os.system and
os.popen to wait there but immediately continue to the next python line (to
avoid this I'm using a thread for now).

As an example I'm using this so far.
If I use pythonw to launch the script, notepad is launched, the script is
killed but the DOS window stay there.


More information about the Tutor mailing list