Where are the geoprocessing results?

2205
5
Jump to solution
10-19-2012 08:17 AM
FionaGregory
New Contributor II
When I run a geoprocessing tool from ArcCatalog or ArcMap, the messages regarding the progress/success/warnings related to the running of the tool can be found in the Results window.
When I run arcpy geoprocessing tools from a Python script from the Python Shell, where does this report on the results go? Can I get it to print to the screen, or direct it to a file?
Thanks,
Fiona
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
ChrisSnyder
Regular Contributor III
I use

arcpy.GetMessages() #returns all messages (messages, errors, warnings, etc)

Take a look at the documentation: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00150000000p000000.htm

View solution in original post

0 Kudos
5 Replies
ChrisSnyder
Regular Contributor III
I use

arcpy.GetMessages() #returns all messages (messages, errors, warnings, etc)

Take a look at the documentation: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00150000000p000000.htm
0 Kudos
FionaGregory
New Contributor II
This was a good answer.

If I put

print arcpy.GetMessages()

in my script, it will print the messages from the latest tool that was run.
However, of course it will not print these messages until after the tool has run.
In my case, I prefer to see it while because I am having a problem with something hanging.

To see the results WHILE the tool is being run I think I have to convert the script into a script tool so I can run it from ArcCatalog.
0 Kudos
ChrisSnyder
Regular Contributor III
I don't think there is a way to return the messages in "real time"... but you could do something like:

print "Attempting to Clip..."
arcpy.Clip_analysis(...)
print "Clip completed..."

or
try:
   arcpy.Clip_analysis(...)
except:
   print "Clip failed!"


What leads you to believe the tool is hanging vs. just taking a long time?
0 Kudos
FionaGregory
New Contributor II
Hi Chris

Seeing the Results in real time is how I can tell if it is hanging or not. If it is "Writing Feature xxxxxx" and #xxxxxx keeps changing, I know it is working. If it gets stuck and the feature # does not change, and the Messages don't change either (it does not proceed to a further stage) I know it is hanging. Thus the need to see the Results.

F.
0 Kudos
ChrisSnyder
Regular Contributor III
I don't think you can get a hook into the realtime tool messages. However...

Maybe the feature it appears to be hanging on is just a large feature that requires extra time to process? If you look at this feature (probably has the same OBJECTID field value as the message indicates), is there something unusual about it? How many verticies does it have?

The TaskManger can be a useful tool in diagnosing things like this. While the tool appears to hang, what is going in parent process (ArcMap.exe if you are calling the tool from that application). Is the processor or RAM usage fluctuating? Do you see the read and/or write bytes increasing? How long will the tool run if you don't cancel it?

Also, if the tool is indeed hanging, would your script do something else (like try an alternate tool, or use a modified tool parameter)?

While it may be more complex than you are wanting to do, you could accomlish a sort of "time out" process by using the "subprocess" module.
0 Kudos