[Tutor] Tutor Digest, Vol 37, Issue 15

learner404 learner404 at gmail.com
Mon Mar 5 21:07:36 CET 2007

On 3/5/07, Tony Cappellini <cappy2112 at gmail.com> wrote:
> Rename your file from .py to .pyw.
> This will prevent the DOS window from appearing

It's not the DOS window from the Python script I was talking about  (in my
mail I said "my python
script is launched with pythonw") but the one resulting from the os.systemor
os.popen commands.

The two solutions that Alan gave are perfect for these :)

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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070305/6755cc6c/attachment-0001.htm 

More information about the Tutor mailing list