Chris Angelico schreef:
On Fri, Oct 2, 2020 at 7:51 PM Gertjan Klein <gkl...@xs4all.nl> wrote:

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").

That sounds a bit dismissive. Who would do that complaining? I would like to be able to do this for scripts I write for myself. If these scripts have something to tell me, they should make sure I get to see that. If they don't, the console can disappear (if started from explorer). I can do this with "input('Press enter when done')" easily; however, if I start the script from a console window I get to press enter too, needlessly.

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.

I specifically asked for the opposite of consistency.

Regards,
Gertjan.
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to