Console printing
Emile van Sebille
emile at fenx.com
Fri Mar 16 20:57:08 EST 2001
More information about the Python-list mailing list
Fri Mar 16 20:57:08 EST 2001
- Previous message (by thread): Guido on SlashDot
- Next message (by thread): Console printing
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Invoke pythone with the -u option Emile van Sebille emile at fenx.com "Costas Menico" <costas at meezon.com> wrote in message news:3ab2c183.4460238 at News.CIS.DFN.DE... > Why does the following program only prints the output (in the run > method) when the while loop terminates? Please note that this is > running in a thread. I though a sleep() is supposed to allow time for > console to update itself. I am using Pythonwin. > > import threading > import time > import sys > > class wasteTime(threading.Thread): > > def run(self): > # run forever > self.running=1 > while self.running: > print time.time() > time.sleep(1) > > def stop(self): > self.running=0 > > th=wasteTime() > > print "Start thread" > startTime=time.time() > th.start() > while time.time()<startTime+5: > time.sleep(1) > > # I want to kill the th thread right here. > th.stop() > print "Finished Thread" > sys.exit() > > #Costas >
- Previous message (by thread): Guido on SlashDot
- Next message (by thread): Console printing
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list