0

I am using cygwin to run a python script which use a while loop and time.sleep() to display an output. If I exclude time.sleep() from inside of loop, cygwin terminal display the output as expected. When I use time.sleep() function it don't show any output.

import time
while True:
      print "hello world"

This example is working without time.sleep()

import time
while True:
    print "hello world"
    time.sleep(1)

This code don't display any output in cygwin terminal.

  • I can not reproduce this issue with Python 2.7.14 on an up-to-date installation of Cygwin (64-bit) running on top of Windows 10. – Kusalananda Nov 1 '17 at 8:53
  • Thanks, I am also using python2.7 in Windows 10 64-bit installation. – Tamim Nov 1 '17 at 8:55
  • 1
    Perhaps it depends on the type of terminal emulator, which python is not recognising. Try running python with option -u for unbuffered output. – meuh Nov 1 '17 at 10:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.