On Fri, Oct 2, 2020 at 7:51 PM Gertjan Klein <gkl...@xs4all.nl> wrote: > > Eryk Sun wrote: > > > If .py files are associated with py.exe or python.exe, then running a > > .py script either inherits or allocates a console and attaches to it. > > Is it possible to determine, from within Python, whether Python > allocated or inherited the console? This could be useful to know in a > (global) error trap: to be able to see a traceback, the console must > remain open, which won't happen if Python allocated the console itself. >
It might be possible, but then there'd have to be lots of magic and the result would be a different set of complaints ("sometimes I get a black window, other times it just disappears"). Instead of trying to detect and such, maybe there needs to be a standard recommendation for an atexit or something - advise people to "stick this line at the top of your program so the black window stays around". No magic, and completely consistent. ChrisA -- https://mail.python.org/mailman/listinfo/python-list