Select to view content in your preferred language

install arcpy on 9.3.1?

5054
14
07-21-2010 11:59 PM
runegullstrom
Emerging Contributor
Hi,

I've tried to install arcpy* on my 9.3.1 machine but
when I import arcpy in a script it fails. Is it possible at all?

(*just copied the arcpy dir across from a machine with arcgis 10 and
adjusted all the paths I thought necessary)

regards,

Rune
0 Kudos
14 Replies
ClaireInbody
Deactivated User
I am not a programmer so I was using arcpy because its easy to use for me the GIS person. I want to avoid using our company programmers as they other things to work on. Maybe build a model for it export to python? I am trying to add 60 plus fields to a shapefile automatically instead of the user creating it manually. Since it is something they will be doing alot, but the model was going to be huge...(tons of add field tools!)
0 Kudos
ChrisSnyder
Honored Contributor
How about:

fieldInfoList = [["FIELD1", "LONG"],["FIELD2", "TEXT", "30"],["FIELD3", "DOUBLE"]]
for fieldInfo in fieldInfoList:
   if fieldInfo[1] in ("LONG","SHORT","DOUBLE","FLOAT"):
      gp.AddField_management (layer, fieldInfo[0], fieldInfo[1])
   elif fieldInfo[1] == "TEXT":
      gp.AddField_management (layer, fieldInfo[0], fieldInfo[1], "", "", fieldInfo[2])
   else:
      print "Uh oh!"
0 Kudos
ChrisSnyder
Honored Contributor
How about somthing like:

fieldInfoList = [["FIELD1", "LONG"],["FIELD2", "TEXT", "30"],["FIELD3", "DOUBLE"]]
for fieldInfo in fieldInfoList:
   if fieldInfo[1] in ("LONG","SHORT","DOUBLE","FLOAT"):
      gp.AddField_management (layer, fieldInfo[0], fieldInfo[1])
   elif fieldInfo[1] == "TEXT":
      gp.AddField_management (layer, fieldInfo[0], fieldInfo[1], "", "", fieldInfo[2])
   else:
      print "Uh oh!"
0 Kudos
LoganPugh
Frequent Contributor
Why not create an empty template feature class (just in ArcCatalog, not in code) with all the fields you need once, and then each time your script/model runs have it create a new feature class (Copy Features or Create Feature Class) from the template and populate (Append) it with the appropriate data?
0 Kudos
GroundHogg
Emerging Contributor
The v10 arcpy "site-package" and associated functionality is not backwards compatible. There is no "hack" as the code/functionality in arcpy simply does not exist in the v9.3 libraries.

Generally however, the v9.x gp object created with these three different methods IS forward compatible:
gp = win32com.client.Dispatch("esriGeoprocessing.GpDispatch.1") #valid for v9.0, v9.1, v9.2, v9.3, and v10.0
gp = arcgisscripting.create() #valid for v9.2, v9.3, and v10.0
gp = arcgisscripting.create(9.3) #valid for v9.3 and v10.0



I have version 10.0, none of those methods work: I get the error "No module named argisscripting".

I also can't find any information so far on how you create gp object in version 10.0, there are .net ArcObjects examples, but none in python.  the only reason I want it is so I can use the Dispatch method, win32com is not referenced (or installed apparently), and arcgisscripting appears to be deprecated as well.
0 Kudos