if STREAM.isatty():

Chris Angelico rosuav at gmail.com
Fri Aug 30 15:56:46 EDT 2019


On Sat, Aug 31, 2019 at 5:40 AM Eryk Sun <eryksun at gmail.com> wrote:
>
> On 8/30/19, Chris Angelico <rosuav at gmail.com> wrote:
> > On Sat, Aug 31, 2019 at 2:26 AM Michael Torrie <torriem at gmail.com> wrote:
> >> On Fri, Aug 30, 2019, 05:02 Hongyi Zhao <hongyi.zhao at gmail.com wrote:
> >>
> >>> Because without using sleep, the stuff on screen will display very
> >>> shortly and then disappear.  Is this not your testing result?
> >>
> >> No it is not. What kind of terminal are you using?
> >
> > Probably a Windows computer and just double-clicking on the program to
> > make it do stuff.
> >
> > Recommendation: If that's the case, get an actual terminal. Learn to use
> > it.
>
> Or simply run python.exe from another console process that keeps the
> console alive (it's reference counted), which is typically cmd.exe or
> powershell.exe.

Not sure what you mean by "reference counted", but yes, if you start
python.exe as a child of some shell such as cmd.exe, then the terminal
that cmd.exe is running in will remain. That is the most normal way to
do things.

Of course, most of us use a shell that's a tad more powerful than
cmd.exe, but the effect is the same regardless.

ChrisA



More information about the Python-list mailing list