Python3 sleep() problem

Not enough credits to upvote
Not enough credits to downvote
By: Speedbird (SysAdmin), Created 8 years ago, Updated 8 years ago.
I was writing a simple program on Python 3.1 and I stumbled upon this:

If I run this on the IDLE it works as intended - prints "Initializing." and then adds two dots, one after each second, and waits for input.

from time import sleep

def initialize():
print('Initializing.', end='')
print(" .", end='')
print(" .", end='')


The problem is that when I double-click the .py to execute the file, it runs on python.exe instead of pythonw.exe, and strange things happen: it joins all the sleep() times i.e. makes me wait for 2 seconds, and then prints the whole string Initializing. . . at once. Why does this happen? Is there a way to avoid that happening in the terminal? It works fine if I use the IDLE in both windows and linux.

1 Responses

Not enough credits to upvote
Not enough credits to downvote
By: maniche1 (Member), 8 years ago
import sys

try this

You may post an answer by signing in or registering for an account Here

Welcome to - QA-Stack is a Q&A open source web application written in the best programming language in the galaxy: Python and using the best web framework in the solar system: web2py, be sure to check for discussions about this site. Have a great stay.

QA-Stack source code is available thanks to the cool folks at, browse the source, or follow updates to this projects by visiting the qa-stack page at


Documentation for QA-Stack can be found at the QA-Stack Google Docs Page.


Submit your bugs in i-track, another web application made by the same author (we eat our own dog food): View currently submitted bugs on i-track.

Popular Tags