On 30/08/2019 12:05, Hongyi Zhao wrote:
On Fri, 30 Aug 2019 18:42:51 +1000, Chris Angelico wrote:
There is no magic here. It is simply asking a question, and then making
a decision based on the answer.
What's your mean by saying this? Sorry for my poor English.
"No 'magic'" (魔法 if Google i
On Sat, 31 Aug 2019 09:11:22 +1000, Cameron Simpson wrote:
> '\r' + progress_status
>
> which backs up to the start of the line, writes the status, and leaves
> the cursor at the end.
>
> The latter has the advantage that any subsequent output (egthe shell
> prompt after the programmke exits)
On Fri, 30 Aug 2019 10:25:10 -0600, Michael Torrie wrote:
> No it is not. What kind of terminal are you using?
I use Debian 9 with gnome desktop and the default gnome terminal.
--
https://mail.python.org/mailman/listinfo/python-list
On 31Aug2019 08:57, Cameron Simpson wrote:
On 30Aug2019 10:25, Michael Torrie wrote:
On Fri, Aug 30, 2019, 05:02 Hongyi Zhao
On Fri, 30 Aug 2019 17:53:02 +1000, Chris Angelico wrote:
(Also, why the sleep? Seems unnecessary.)
Because without using sleep, the stuff on screen will display ver
On Sat, Aug 31, 2019 at 8:58 AM Eryk Sun wrote:
>
> On 8/30/19, Chris Angelico wrote:
> > On Sat, Aug 31, 2019 at 7:42 AM Eryk Sun wrote:
> >
> >> In Windows 8+, a process attaches to a console by opening
> >> "\Device\ConDrv\Connect" as a connection to an instance of the console
> >> host proce
On 30Aug2019 10:25, Michael Torrie wrote:
On Fri, Aug 30, 2019, 05:02 Hongyi Zhao
On Fri, 30 Aug 2019 17:53:02 +1000, Chris Angelico wrote:
> (Also, why the sleep? Seems unnecessary.)
Because without using sleep, the stuff on screen will display very
shortly and then disappear. Is this not yo
On 8/30/19, Chris Angelico wrote:
> On Sat, Aug 31, 2019 at 7:42 AM Eryk Sun wrote:
>
>> In Windows 8+, a process attaches to a console by opening
>> "\Device\ConDrv\Connect" as a connection to an instance of the console
>> host process, conhost.exe. This handle is stored internally as
>> "Consol
On Sat, Aug 31, 2019 at 7:42 AM Eryk Sun wrote:
>
> On 8/30/19, Chris Angelico wrote:
> > On Sat, Aug 31, 2019 at 5:40 AM Eryk Sun wrote:
> >
> >> Or simply run python.exe from another console process that keeps the
> >> console alive (it's reference counted), which is typically cmd.exe or
> >>
On 8/30/19, Chris Angelico wrote:
> On Sat, Aug 31, 2019 at 5:40 AM Eryk Sun wrote:
>
>> 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 counte
On Sat, Aug 31, 2019 at 5:40 AM Eryk Sun wrote:
>
> On 8/30/19, Chris Angelico wrote:
> > On Sat, Aug 31, 2019 at 2:26 AM Michael Torrie wrote:
> >> On Fri, Aug 30, 2019, 05:02 Hongyi Zhao >>
> >>> Because without using sleep, the stuff on screen will display very
> >>> shortly and then disappe
On 8/30/19, Chris Angelico wrote:
> On Sat, Aug 31, 2019 at 2:26 AM Michael Torrie wrote:
>> On Fri, Aug 30, 2019, 05:02 Hongyi Zhao >
>>> 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
Eric, thank you for the detailed answer. I stashed it away for future
review ;-).
On 8/30/2019 3:10 AM, Eryk Sun wrote:
On 8/29/19, Terry Reedy wrote:
On 8/29/2019 10:16 AM, Eryk Sun wrote:
In Windows, isatty() is true for any character-type file.
Does that mean one that can either send
On Sat, Aug 31, 2019 at 2:26 AM Michael Torrie wrote:
>
> On Fri, Aug 30, 2019, 05:02 Hongyi Zhao
> > On Fri, 30 Aug 2019 17:53:02 +1000, Chris Angelico wrote:
> > > (Also, why the sleep? Seems unnecessary.)
> >
> > Because without using sleep, the stuff on screen will display very
> > shortly an
On Fri, Aug 30, 2019, 05:02 Hongyi Zhao On Fri, 30 Aug 2019 17:53:02 +1000, Chris Angelico wrote:
> > (Also, why the sleep? Seems unnecessary.)
>
> 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. Wha
On Fri, 30 Aug 2019 18:42:51 +1000, Chris Angelico wrote:
> There is no magic here. It is simply asking a question, and then making
> a decision based on the answer.
What's your mean by saying this? Sorry for my poor English.
--
https://mail.python.org/mailman/listinfo/python-list
On Fri, 30 Aug 2019 17:53:02 +1000, Chris Angelico wrote:
> That's because sys.stderr is never changing in your example here. Try
> checking whether sys.stdout is a TTY instead.
OMG, thanks a lot, this does the trick.
>
> (Also, why the sleep? Seems unnecessary.)
Because without using sleep, t
On Fri, Aug 30, 2019 at 6:36 PM Hongyi Zhao wrote:
>
> On Thu, 29 Aug 2019 16:42:44 +0100, Rhodri James wrote:
>
> > I don't understand what's to not to understand.
> >
> >if condition:
> > do_something_because_condition_is_true()
> >else:
> > do_something_because_condition_is_fa
On Thu, 29 Aug 2019 16:42:44 +0100, Rhodri James wrote:
> I don't understand what's to not to understand.
>
>if condition:
> do_something_because_condition_is_true()
>else:
> do_something_because_condition_is_false()
>
> is a perfectly normal construction. If you mean somethin
On Fri, Aug 30, 2019 at 5:51 PM Hongyi Zhao wrote:
>
> On Fri, 30 Aug 2019 01:29:48 +0200, Peter Otten wrote:
>
> > Perhaps a simple example can help?
> >
> > $ cat checktty.py import sys
> >
> > stream = sys.stdout
> >
> > if stream.isatty():
> > message = "tty"
> > else:
> > message = "n
On Fri, 30 Aug 2019 01:29:48 +0200, Peter Otten wrote:
> Perhaps a simple example can help?
>
> $ cat checktty.py import sys
>
> stream = sys.stdout
>
> if stream.isatty():
> message = "tty"
> else:
> message = "no tty"
> print(message, file=stream)
>
> When you run the script it print
On 8/30/19, Eryk Sun wrote:
>
> GetFileType classifies files for all of the following NT device types
> as FILE_TYPE_DISK (akin to Unix S_IFBLK):
To clarify, file-system files and directories in a mounted file system
on such as device are akin to Unix S_IFREG and S_IFDIR. Their file
type is FILE_
On 8/29/19, Terry Reedy wrote:
> On 8/29/2019 10:16 AM, Eryk Sun wrote:
>
>> In Windows, isatty() is true for any character-type file.
>
> Does that mean one that can either send or receive data a character at a
> time, as opposed to a block at a time?
Yes, any number of bytes can be written to a
Hongyi Zhao wrote:
> On Thu, 29 Aug 2019 16:42:44 +0100, Rhodri James wrote:
>
>> I don't understand what's to not to understand.
>>
>>if condition:
>> do_something_because_condition_is_true()
>>else:
>> do_something_because_condition_is_false()
>>
>> is a perfectly normal con
On 8/29/2019 10:16 AM, Eryk Sun wrote:
On 8/29/19, Rhodri James wrote:
"isatty()" is a method of the io.IOBase class that checks to see
if the stream is connected to a tty, or to use less jargon, if it is
interactive. "tty" was I think originally an abbreviation for
"teletype", but nowadays i
On 29Aug2019 22:38, Hongyi Zhao wrote:
On Thu, 29 Aug 2019 16:42:44 +0100, Rhodri James wrote:
The original code snippet's logic is as follows:
if STREAM.isatty():
p = (self.progress_template + '\r') % params
else:
[do something to reset the new value of p]
On 2019-08-29 23:38, Hongyi Zhao wrote:
On Thu, 29 Aug 2019 16:42:44 +0100, Rhodri James wrote:
I don't understand what's to not to understand.
if condition:
do_something_because_condition_is_true()
else:
do_something_because_condition_is_false()
is a perfectly normal construc
On 8/29/2019 8:23 AM, Rhodri James wrote:
On 29/08/2019 04:40, Hongyi Zhao wrote:
Hi,
I read the following code:
https://github.com/shichao-an/homura/blob/master/homura.py
On the line 265-266, it said:
if STREAM.isatty():
p = (self.progress_template + '\r') % params
W
On Thu, 29 Aug 2019 16:42:44 +0100, Rhodri James wrote:
> I don't understand what's to not to understand.
>
>if condition:
> do_something_because_condition_is_true()
>else:
> do_something_because_condition_is_false()
>
> is a perfectly normal construction. If you mean somethin
On 29/08/2019 16:29, Hongyi Zhao wrote:
On Thu, 29 Aug 2019 14:51:43 +0100, Rhodri James wrote:
When the stream isn't connected to an interactive terminal, obviously.
For example, when it's writing to file.
But I cannot see any thing like this in the code.
I don't understand what's to not t
On Thu, 29 Aug 2019 14:51:43 +0100, Rhodri James wrote:
> When the stream isn't connected to an interactive terminal, obviously.
> For example, when it's writing to file.
But I cannot see any thing like this in the code.
Regards
--
https://mail.python.org/mailman/listinfo/python-list
On 8/29/19, Rhodri James wrote:
>
> "isatty()" is a method of the io.IOBase class that checks to see
> if the stream is connected to a tty, or to use less jargon, if it is
> interactive. "tty" was I think originally an abbreviation for
> "teletype", but nowadays it refers to any terminal, anywher
On 29/08/2019 14:37, Hongyi Zhao wrote:
On Thu, 29 Aug 2019 13:23:07 +0100, Rhodri James wrote:
TLDR: these two lines set up (but don't output) a progress message for
an interactive stream.
Thanks a lot for your deeply notes on this. But, if so, when will the
``else ...'' be executed in the o
On Thu, 29 Aug 2019 13:23:07 +0100, Rhodri James wrote:
> TLDR: these two lines set up (but don't output) a progress message for
> an interactive stream.
Thanks a lot for your deeply notes on this. But, if so, when will the
``else ...'' be executed in the original code:
if STREAM.isat
On 29/08/2019 04:40, Hongyi Zhao wrote:
Hi,
I read the following code:
https://github.com/shichao-an/homura/blob/master/homura.py
On the line 265-266, it said:
if STREAM.isatty():
p = (self.progress_template + '\r') % params
What's mean by using the above two lines? C
34 matches
Mail list logo