How to display "Background Processing" messages in Python

2688
3
05-01-2015 12:19 PM
JoseSanchez
Occasional Contributor III

Hello everyone,

When running ModelBuilder if the option "Background Processing" is disabled it shows all the commands executed on the screen.

How can I do the same thing when running a Pytho script or at least when I run the script with IDLE or PyScripter?

the problem when testing a Python script it does not show what is executing

Thanks

0 Kudos
3 Replies
TimWitt2
MVP Alum

Jose,

I use the following in my script to keep up with what the code is doing

print '(10% Completed) Copying features from the SDE to the Local Machine'

Tim

curtvprice
MVP Esteemed Contributor

Even when things are running in the background,  you can see the messages in the Results window as they are executing (you can click on the little arcmap progress icon to bring up the results window easily, otherwise Geoprocessing > Results will bring it up).

If you are running a Python script as a script tool, "print" will not show up in to GP messages; you need to use the arcpy messaging methods (AddMessage, AddWarning, AddError). And there is always the Progressor methods, which are pretty nifty when running a script in the foreground.

BlakeTerhune
MVP Regular Contributor

I typically use the method Tim Witt  described to just print whatever I want to the Python Interpreter window. If you're using Esri geoprocessing tools, you can also print the original Esri messages with GetMessages (arcpy)​.

0 Kudos