import time import sys while True: # Wait for 5 seconds print('To stderr.', file=sys.stderr) time.sleep(2)