AnsweredAssumed Answered

unbuffered print() to ArcMap Python window?

Question asked by theMC5 on Aug 29, 2014
Latest reply on Oct 13, 2015 by dazzasmith

I have a Python Add-In for ArcMap. Add-Ins don't have access to a progress bar (see Adding messaging to Python Add-in ). Plan B - I am writing messages during a lengthy loop to the Python window using print(mymsg). But nothing appears in the Python window during the loop, then suddenly all the messages appear at the end of the loop. Less than helpful! Sounds like a buffered stdout?

 

So I tried doing sys.stdout.flush() after each print(), and I get this: AttributeError: 'geoprocessing sys.stdout object' object has no attribute 'flush'. I guess that's how the Python window works - ArcMap resets stdout to a custom object that buffers, but lacks a flush() method.

 

Whatsa guy to do?  Thanks!

Outcomes