Using arcgisscripting's "9.3" switch

This blog post was written by Ghislain Prince, Product Engineer on the Geoprocessing Team in Redlands.

Hi Everybody!

We learned in the Advanced Python Scripting Technical Workshops at UC that many of you who use ArcGIS 9.3 do not yet use the changes we made to the geoprocessor.  We just wanted you guys to be aware of this option when writing your Python scripts at 9.3.  The 9.3 switch option is specified when the geoprocessor is created; in code it looks like this

import arcgisscripting

gp = arcgisscripting.create(9.3)

Existing (pre-9.3) scripts will obviously not have this option as it didn’t exist before the 9.3 release. We’re sure you’ve already noticed that they continue to work unchanged.  To get the 9.3 geoprocessor behavior, it is not enough to simply change gp = arcgisscripting.create() to gp = arcgisscripting.create(9.3)  -  that does not work, because your code needs to be  updated elsewhere in your script to accommodate the changed behavior.

The main goal for this switch is that when you create new scripts in ArcGIS  9.3, you will use the “9.3” geoprocessor and get a much nicer coding experience.  This “nicer” experience is achieved because the geoprocessor uses more of Python’s native structures as inputs and outputs. 

It’s obvious that the improvements to the geoprocessor make it easier for you to write code and resulting code is easier to read and maintain.  Of course the changes are not limited to the List functions; here’s the complete list of differences and a comparison with several code examples.

This entry was posted in Analysis & Geoprocessing and tagged , , . Bookmark the permalink.

Leave a Reply

2 Comments

  1. curtvprice says:

    Thanks Ghislain, for the links to these very useful help articles.

    I have a comment and a question….

    In contrast to the list functions, having the tools return Result objects is a little more complicated — but in my view it is much worth it, as the Result object gives easy access to needed information about the tool execution.

    Will the planned ArcPy module inherit the properties of arcgisscripting?

  2. dwynne says:

    Hey Curtis,
    Yes, with 9.4 and ArcPy, tools will also be returning Result objects.

    -Dave