Hi, I'm trying to write a piece of code that spawns a thread and
prints dots every half second until the thread spawned is finished.
Code is
something like this:

import threading
class MyThread ( threading.Thread ):
        def run ( self ):
                myLongCommand()...

import time

t = MyThread()
t.start()

while t.isAlive():
        print "."
        time.sleep(.5)

print "OK"

The thing is this doesn't print a dot every half second. It just
pauses for ages until the thread is finished and prints prints ".OK".
But if I take out the "time.sleep(.5)" line it will keep printing dots
really fast until the thread is finished. So it looks like its the
time.sleep(.5) bit that is messing this up somehow?

Any ideas?

Thanks!
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to