Python sleep doesn't work right in a loop?

Mike Rovner mrovner at propel.com
Wed Apr 6 15:23:05 EDT 2005


ritterhaus at yahoo.com wrote:
> ... SHOULD toggle On and Off four times with one-second pauses. When I
> run this, the loop pauses the full eight seconds then prints the Ons
> and Offs all at once. What's up with that?

Run your script as:

python -u script.py

for unbuffered output.




More information about the Python-list mailing list