Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #101744 > unrolled thread

Re: problem

Started byeryk sun <eryksun@gmail.com>
First post2016-01-15 05:27 -0600
Last post2016-01-15 05:27 -0600
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: problem eryk sun <eryksun@gmail.com> - 2016-01-15 05:27 -0600

#101744 — Re: problem

Fromeryk sun <eryksun@gmail.com>
Date2016-01-15 05:27 -0600
SubjectRe: problem
Message-ID<mailman.6.1452857264.15297.python-list@python.org>
 On Thu, Jan 14, 2016 at 7:03 PM, Andrew Ongko <andrew.ongko@gmail.com> wrote:
> At least, this way, the cmd doesn't close by itself.

This phrasing may perpetuate a common misconception that the Windows
console is (or is created by) cmd.exe. The cmd.exe shell is just
another console client process, no different from python.exe or
powershell.exe in that respect.

When you run a .py script from a GUI application such as explorer.exe,
Windows creates a console window for python.exe, since it doesn't
inherit one. In Windows 7+, the console window is hosted by an
instance of conhost.exe (i.e. this process has the window procedure
and message loop). Older versions host it in csrss.exe. When
python.exe exits, there's no longer a process attached to the console,
so the console host process also exits. To keep the console window
alive, you can either start python.exe from an existing console
process (e.g. cmd, powershell, or even python), or just before exiting
create a new console process that attaches to the console.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web