Flush designer console output from Python

Is there any way to flush the output from Python so that the console and script playground output updates? I have a long running script and I need to see progress as it’s working. Currently the output all just appears at the end.

I tried sys.stdout.flush(), but the console output does not update.

Can you give us a little more context about what you’re doing and how you’re doing it?

This updates the console in real time for me:

def longRunning():
	from time import sleep
	
	for i in xrange(10):
		print "step %d" % i
		sleep(3)
		
system.util.invokeAsynchronous(longRunning)

Ah yes. I was forgetting the invokeAsynchronous. That’s much better.

Thanks.