Unix-head needs to Windows-ize his Python script (II)

Nobody nobody at nowhere.com
Tue Oct 26 19:38:17 CEST 2010

On Tue, 26 Oct 2010 14:44:11 +0000, Grant Edwards wrote:

>> There is no difference based on the name of your executable, how it
>> is built, or what libraries it links to; the only difference is in
>> its run-time behaviour, whether it invokes any GUI functions or not.
> No, we're not talking about whether apps invoke GUI functions or not.
> That's completely orthogonal to the issue at hand.  We're talking
> about whether desktop manager should run the program with
> stdin/stdout/stderr connected to /dev/null or connected to a terminal
> emulator.
> The windows desktop determines that (like it determines other things)
> by looking at the filename.  Other desktops generally have that
> information associated with the icon/button/menu-entry, not with the
> executable's filename.

Windows executables contain an embedded type field which distinguishes
between GUI and console executables (as well as those for the POSIX
subsystem, "native" executables, etc).

python.exe is a console executable, pythonw.exe is a GUI executable. Hence
python.exe automatically gets a console window, while pythonw.exe doesn't.
That's the whole reason why Windows has separate python.exe and
pythonw.exe programs, while Unix can use a single /usr/bin/python program
for both GUI and console usage.

The Windows approach makes it easier to Do The Right Thing automatically,
but it's a nuisance if you have a program which doesn't really fit into
either of the "console" or "GUI" pigeonholes.

More information about the Python-list mailing list