Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
up vote 10 down vote accepted

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)
...'stuff just happened, better write that down.')

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

share|improve this answer

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.

share|improve this answer

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

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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