Strange terminal behavior after quitting Tkinter application
Christian Gollwitzer
auriocus at gmx.de
Wed Nov 4 01:34:24 EST 2020
Am 03.11.20 um 23:34 schrieb Dennis Lee Bieber:
>
> Out of curiosity, does Python on Linux honor the .pyw extension?
>
> On Windows, .pyw indicates a Python program that implements a GUI and
> will NOT make use of console (stdin/stdout/stderr).
On Linux, there is no such distinction. On Windows it is only needed
because, if you connect stdin/out, a terminal window pops up. >For a
true GUI program that is notr acceptable, the user will be puzzled what
this ugly useless window wants to do, and therefore a flag in the EXE
file format indicates to Windows if it should pop up the console or not.
On Linux, stdin/out is always connected. You must run your program from
a terminal window to see it, otherwise it is silently connected to some
channel in the background by the desktop environment. It can happen that
the standard channels are closed, if you run a program in the terminal
and then close the terminal (which sends SIGHUP to the program). In this
case the program might later on throw I/O errors, when printing to stdout.
Christian
More information about the Python-list
mailing list