Re: [Tutor] Displaying Status on the Command Line

2018-11-08 Thread Zachary Ware
On Thu, Nov 8, 2018 at 10:10 AM Steven D'Aprano wrote: > Sorry, I don't understand that. Maybe its too early in the morning for > my brain, but given that you've imported the Python 3 print function > from the __future__ why do you need the customer wrapper? > > from __future__ import print_functi

Re: [Tutor] Displaying Status on the Command Line

2018-11-08 Thread Steven D'Aprano
On Thu, Nov 08, 2018 at 09:36:53AM -0600, Zachary Ware wrote: > You can use any of the `print` function tricks above in Python 2 with > the following boilerplate: > > from __future__ import print_function > > import sys > > _orig_print = print > > def print(*args, **kwargs): > flush = kwar

Re: [Tutor] Displaying Status on the Command Line

2018-11-08 Thread Zachary Ware
On Thu, Nov 8, 2018 at 4:12 AM Chip Wachob wrote: > I should have mentioned that I'm working with Python 2, but I think I > can parse my way through these examples. You can use any of the `print` function tricks above in Python 2 with the following boilerplate: from __future__ import print_funct

Re: [Tutor] Displaying Status on the Command Line

2018-11-08 Thread Alan Gauld via Tutor
On 08/11/2018 04:06, Chip Wachob wrote: > I should have mentioned that I'm working with Python 2, but I think I > can parse my way through these examples. OK, In that case you may want to investigate the sys.stdout approach. Just remember it's a pre opened file and use the write() method. But it

Re: [Tutor] Displaying Status on the Command Line

2018-11-08 Thread Chip Wachob
Wow! Thank you! Lots of things for me to try. I should have mentioned that I'm working with Python 2, but I think I can parse my way through these examples. Best, On 11/7/18, Cameron Simpson wrote: > On 08Nov2018 10:00, Steven D'Aprano wrote: >>> Note that I need this to be platform agnostic

Re: [Tutor] Displaying Status on the Command Line

2018-11-08 Thread Avi Gross
d to use alternate syntax. Not sure how you flush buffers but you can skip the print statement and write in other ways to sys.stdout. -Original Message- From: Tutor On Behalf Of Alan Gauld via Tutor Sent: Wednesday, November 7, 2018 2:15 PM To: tutor@python.org Subject: Re: [Tutor] Display

Re: [Tutor] Displaying Status on the Command Line

2018-11-07 Thread Cameron Simpson
On 08Nov2018 10:00, Steven D'Aprano wrote: Note that I need this to be platform agnostic. That's hard, even on a single platform like Linux. Most, nearly all, terminal honour carriage return and backspace. That is technically enough. Even terminals with a destructive backspace (rare - it i

Re: [Tutor] Displaying Status on the Command Line

2018-11-07 Thread Steven D'Aprano
On Wed, Nov 07, 2018 at 11:22:22AM -0500, Chip Wachob wrote: > Hello, > > I'm sure that this is simple and my searches have just not used the > correct words. > > What I would like to do is display, on a single line, in the terminal > / command line a progress percentage, or, simply a sequence of

Re: [Tutor] Displaying Status on the Command Line

2018-11-07 Thread Cameron Simpson
On 07Nov2018 11:22, Chip Wachob wrote: I'm sure that this is simple and my searches have just not used the correct words. What I would like to do is display, on a single line, in the terminal / command line a progress percentage, or, simply a sequence of - / - \, etc.. or even, accumulating per

Re: [Tutor] Displaying Status on the Command Line

2018-11-07 Thread Zachary Ware
On Wed, Nov 7, 2018 at 1:17 PM Alan Gauld via Tutor wrote: > In Python 3 there are parameters to print() > > while someProcess(): >time.sleep(1) >print('.', end='', sep='') # no newline and no spaces You'll also want `flush=True` here to avoid having your dots buffered until end-of-line

Re: [Tutor] Displaying Status on the Command Line

2018-11-07 Thread Alan Gauld via Tutor
On 07/11/2018 16:22, Chip Wachob wrote: > What I would like to do is display, on a single line, in the terminal > / command line a progress percentage, or, simply a sequence of - / - > \, etc.. or even, accumulating period characters. > > What would the escape codes be, or is there a better way t

[Tutor] Displaying Status on the Command Line

2018-11-07 Thread Chip Wachob
Hello, I'm sure that this is simple and my searches have just not used the correct words. What I would like to do is display, on a single line, in the terminal / command line a progress percentage, or, simply a sequence of - / - \, etc.. or even, accumulating period characters. What would the es