2

Recently I have been making scripts to run geoprocessing tools for a client who is running ArcGIS 9.3. However I only have access to ArcGIS 10.1. As a result I cannot use model builder in 10.1, and have to script everything with arcgisscripting (import arcgisscripting). I cannot find many arcgisscripting examples beyond the 9.3 help files.

My questions are: is there a way to reverse convert 10.1 (arcpy/modelbuilder) scripts to 9.3? Is there a place with good arcgisscripting .py examples? Has anyone else done this?

3 Answers 3

4

Unless you are using geoprocessing tools that are exclusive to 10.1, you should be able to convert it backwards. First export your model to python from model builder. then change

import arcpy

to

import arcgisscripting

next set a variable to the arcgisscripting module you imported

gp = arcgisscripting.create()

after that you need to import your gp toolboxes

gp.AddToolbox("C:/Program Files (x86)/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx")

after that do a find/replace and change arcpy to gp

arcpy.Intersect_analysis()

to

gp.Intersect_analysis()

i converted a bunch of 9.3 scripts to 10 using the reverse of this method and did not have any issues

4

As @Zachary mentioned, the key is:

  1. using tools that are available in both 10.1 and 9.3 at the same license level (don't forget that some tools changed license from 9.3 to 10.1)
  2. change "import arcpy" to "import arcgisscripting"

If you really wanted to be sneaky, though, instead of creating a new variable called gp, from: gp = arcgisscripting.create() and then having to find/replace arcpy to gp, I THINK you should be able to simply set your new variable with the name arcpy = arcgisscripting.create(), and the rest of the tool references should just work.

1
  • I believe you are correct about the variable name. That would be a quick, efficient way to update the script.
    – Zachary
    Commented Feb 6, 2013 at 12:05
0

arcgisscripting (ArcGIS 9 Python) isn't as full featured as arcpy (ArcGIS 10 Python) This forum has a lot of discussion of both ArcGIS Python modules

http://forums.arcgis.com/forums/117-Python

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.