Re: Problems with sys.stout.flush()

2009-05-24 Thread Joel Ross
AK wrote: import time, sys print "ONE", sys.stdout.flush() time.sleep(0.5) print "\rTWO", sys.stdout.flush() time.sleep(0.5) Running the command above prints out ONE TWO but running for i in range(10): print "ONE", time.sleep(0.2) prints out ONE ONE ONE ONE ONE ONE ONE ONE ONE ONE

Re: Problems with sys.stout.flush()

2009-05-24 Thread Hendrik van Rooyen
"Joel Ross" To: Sent: Sunday, May 24, 2009 4:32 AM Subject: Re: Problems with sys.stout.flush() > Mel wrote: > > Joel Ross wrote: > >> Rhodri James wrote: > > [ ... ] > >>> Except that you still have the interesting issue that your environment &

Re: Problems with sys.stout.flush()

2009-05-23 Thread AK
Joel Ross wrote: Rhodri James wrote: On Sat, 23 May 2009 18:19:11 +0100, Joel Ross wrote: Now I can move onto next one. Except that you still have the interesting issue that your environment isn't responding to '\r' correctly, which worries me rather. Or did you never test that? Yeah I ga

Re: Problems with sys.stout.flush()

2009-05-23 Thread Joel Ross
Mel wrote: Joel Ross wrote: Rhodri James wrote: [ ... ] Except that you still have the interesting issue that your environment isn't responding to '\r' correctly, which worries me rather. Or did you never test that? Yeah I gave the "\r" a go and it kept printing out on a new line I will lo

Re: Problems with sys.stout.flush()

2009-05-23 Thread Mel
Joel Ross wrote: > Rhodri James wrote: [ ... ] >> Except that you still have the interesting issue that your environment >> isn't responding to '\r' correctly, which worries me rather. Or did >> you never test that? > Yeah I gave the "\r" a go and it kept printing out on a new line I will > look

Re: Problems with sys.stout.flush()

2009-05-23 Thread Joel Ross
Dennis Lee Bieber wrote: flush() is working perfectly fine -- it says transmit any data still held within internal buffers. It is NOT a "clear screen", "clear line" terminal command. I was mistaken about the sys.stout.flush(). I understand it a little more now thanks -- http://mail.py

Re: Problems with sys.stout.flush()

2009-05-23 Thread Joel Ross
Rhodri James wrote: On Sat, 23 May 2009 18:19:11 +0100, Joel Ross wrote: Now I can move onto next one. Except that you still have the interesting issue that your environment isn't responding to '\r' correctly, which worries me rather. Or did you never test that? Yeah I gave the "\r" a go a

Re: Problems with sys.stout.flush()

2009-05-23 Thread Rhodri James
On Sat, 23 May 2009 18:19:11 +0100, Joel Ross wrote: Now I can move onto next one. Except that you still have the interesting issue that your environment isn't responding to '\r' correctly, which worries me rather. Or did you never test that? -- Rhodri James *-* Wildebeeste Herder to the Ma

Re: Problems with sys.stout.flush()

2009-05-23 Thread Carl Banks
On May 23, 8:20 am, Dave Angel wrote: > Incidentally, Carl's other suggestion, that you use a new variable > instead of overwriting 'char', is a red herring. Yeah, I dropped the ball on this one, I misread his code as being in a loop instead of being called repeatedly. And after criticizing him

Re: Problems with sys.stout.flush()

2009-05-23 Thread Joel Ross
Thanks for all the help guys. I got it to work correctly with this class progress: def __init__(self): self.already = 0 def progressbar(self, number, total, char): percentage = int(100 - round(number*100.0/total)) if percentage > 0: xchar = char * (perc

Re: Problems with sys.stout.flush()

2009-05-23 Thread Steven D'Aprano
On Sun, 24 May 2009 00:44:21 +1000, Joel Ross wrote: > Still having the same problem if I pass it 1000 lines it will printout > 1000 asterisks when I say lines I mean the argument for the > progress() function. I only want to printout 100 asterisks no matter how > many lines I pass to the progres

Re: Problems with sys.stout.flush()

2009-05-23 Thread Dave Angel
Joel Ross wrote: Carl Banks wrote: On May 23, 2:20 am, Joel Ross wrote: Carl Banks wrote: On May 22, 10:33 pm, Joel Ross wrote: Hi all, I'm using python 2.5 and trying to flush the sys.stout buffer with sys.stout.flush(), but doesn't seem to work. Each time a line is printed it appends

Re: Problems with sys.stout.flush()

2009-05-23 Thread Peter Otten
Joel Ross wrote: > class progress: > > def progressbar(self, number, total, char): > > percentage = float(number*100)/total > percentage = int(round(percentage)) > percentage = int(100 - percentage) > self.f=sys.stdout > if percentage > 0: >

Re: Problems with sys.stout.flush()

2009-05-23 Thread Joel Ross
Carl Banks wrote: On May 23, 3:49 am, Joel Ross wrote: def progressbar(self, number, total, char): percentage = float(number*100)/total percentage = int(round(percentage)) percentage = int(100 - percentage) self.f=sys.stdout if percentage > 0:

Re: Problems with sys.stout.flush()

2009-05-23 Thread Carl Banks
On May 23, 3:49 am, Joel Ross wrote: >      def progressbar(self, number, total,  char): > >          percentage = float(number*100)/total >          percentage = int(round(percentage)) >          percentage = int(100 - percentage) >          self.f=sys.stdout >          if percentage > 0: >      

Re: Problems with sys.stout.flush()

2009-05-23 Thread Joel Ross
Carl Banks wrote: On May 23, 2:20 am, Joel Ross wrote: Carl Banks wrote: On May 22, 10:33 pm, Joel Ross wrote: Hi all, I'm using python 2.5 and trying to flush the sys.stout buffer with sys.stout.flush(), but doesn't seem to work. Each time a line is printed it appends the one before it I

Re: Problems with sys.stout.flush()

2009-05-23 Thread Mohammed Mediani
Hi all, Is anyone aware of a 3-d plotting tool for simple mathematical functions. It seems that all the tools available have their problems with new versions. None of matplotlib, nor PyX, nor mat3d, seems to work for 3d anymore. Any suggestions??? Thanks -- http://mail.python.org/mailman/listi

Re: Problems with sys.stout.flush()

2009-05-23 Thread Carl Banks
On May 23, 2:20 am, Joel Ross wrote: > Carl Banks wrote: > > On May 22, 10:33 pm, Joel Ross wrote: > >> Hi all, > > >> I'm using python 2.5 and trying to flush the sys.stout buffer with > >> sys.stout.flush(), but doesn't seem to work. Each time a line is printed > >>    it appends the one before

Re: Problems with sys.stout.flush()

2009-05-23 Thread Joel Ross
Carl Banks wrote: On May 22, 10:33 pm, Joel Ross wrote: Hi all, I'm using python 2.5 and trying to flush the sys.stout buffer with sys.stout.flush(), but doesn't seem to work. Each time a line is printed it appends the one before it I need to clear the output and write a new output without

Re: Problems with sys.stout.flush()

2009-05-22 Thread Carl Banks
On May 22, 10:33 pm, Joel Ross wrote: > Hi all, > > I'm using python 2.5 and trying to flush the sys.stout buffer with > sys.stout.flush(), but doesn't seem to work. Each time a line is printed >    it appends the one before it I need to clear the output and write a > new output without appending

Problems with sys.stout.flush()

2009-05-22 Thread Joel Ross
Hi all, I'm using python 2.5 and trying to flush the sys.stout buffer with sys.stout.flush(), but doesn't seem to work. Each time a line is printed it appends the one before it I need to clear the output and write a new output without appending the previous one. I have tried the -u (unbuffe