I've written a Python script using arcgisscripting to do various processing steps on some data. I'm planning to run it from a stand-alone command-line window (ie. not within ArcGIS at all) and, as such, have a number of print commands in my code to show its status.

However, when I run it from the console I also get a number of other things printed to the console including warnings (such as a warning that my data has no projection) and the full output of the Nearest Neighbour calculation command. These aren't needed, and will clog up the output (I'll be running this as a batch job with the output piped to a file).

Is there any way to get rid of these? I was hoping for a gp.quiet = true command or a gp.silent = true, but can't seem to find any of those. Any ideas?

3 Answers 3


I don't think the geoprocessor object provides any clean way of separating out the response type, as most applications would with a log-level: if it does, there isn't anything apparent from the documentation.

I'd use the python logging module (documentation) to log the output you do care about, instead of using print statements:

import logging
LOG_FILENAME = 'example.log'
logging.basicConfig(filename=LOG_FILENAME, level=logging.INFO)
logging.info('stuff just happened, better write that down.')

Then use tail -f example.log or equivalent to watch the log.


For complex or large batch jobs I include a separate set of functions to send my output to a text file in addition to the console. The console will have all of the messages from my print statements and the geoprocessor output but my text file will only have the bits of information I need to make sure that everything actually worked the way I needed. I usually only pay attention to the console to make sure that there are no python errors and to make sure that the scripts are still running. The log file has all of the important information.


Perhaps you can use a Result object.

something like:

import arcgisscripting

gp = arcgisscripting.create(9.3)

clip = r"C:\polygon.shp"
clipped = r"C:\line.shp"

result = gp.clip_analysis(clip,clipped) #do not consider these arguments, just an example

I did not tried it, but from the result object you can access various members, like GetMessages, ResultMessage, etc. Perhaps if you actually grab a hold on it, you can stop the echoing of messages

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.