[Tutor] Getting Started

Oscar Benjamin oscar.j.benjamin at gmail.com
Thu Dec 19 14:46:33 CET 2013


On 19 December 2013 12:21, eryksun <eryksun at gmail.com> wrote:
> On Thu, Dec 19, 2013 at 4:48 AM, Oscar Benjamin
> <oscar.j.benjamin at gmail.com> wrote:
>>
>> The graphical window that you describe is called cmd.exe and it is the
>> standard "terminal emulator" for Windows.
>
> Oscar,
>
> cmd doesn't create or manage the console window. That's done by
> another process that acts as the console server (conhost, or csrss in
> older versions). cmd is just a command-line shell. When you run
> another program in cmd, like python.exe, the shell's thread just waits
> for the child process to exit. The child process inherits the console
> and standard I/O handles for talking to the console server.
>
> If you run python.exe from Explorer, Windows creates a new console
> window since the executable is marked as a console application. On
> Windows 7 (NT 6.1) it creates 2 processes: python.exe and conhost.exe.
> cmd.exe isn't in the loop.

Thanks for the correction Eryksun. I was confusing cmd.exe with the
console process.

So what then is the purpose of running "cmd /c some_console_app"? For
example the git-bash launcher on my desktop runs
C:\WINDOWS\system32\cmd.exe /c ""Q:\TOOLS\Git\bin\sh.exe" --login -i"

I thought that cmd.exe was being invoked to create the graphical console.

>
>> Now here's what happens if I just type "py" to enter the Python console:
>
> Note that py.exe is installed by Python 3.3. If you haven't installed
> 3.3, you can download the launcher from the project site:
>
> https://bitbucket.org/vinay.sajip/pylauncher

The OP is using 3.3.

I think in the future it will be good to advise Windows users to use
the py.exe launcher. Although this wasn't the initial reason for
adding the launcher it usually solves the issue of needing to set PATH
before being able to locate "python" in the shell.


Oscar


More information about the Tutor mailing list