T
thompson.marisa
Hi.
I'm extremely new to Python and programming as a whole. I have written
a python script with the assistance of ESRI ArcGIS 9.2, which uses
Python 2.4.1, however, it gives me this error when I try to run it.
I've already posted at ESRI support, and I was hoping that Python
people could help me more.
I hope there is something simple I could do to be able to define the
object that it thinks is NoneType. Please when someone responds,
please treat me as an absolute novice.
Thank you,
Marisa
Here is my code:
#
---------------------------------------------------------------------------
# towntab92.py
# Created on: Wed Dec 20 2006 11:09:59 AM
# (generated by ArcGIS/ModelBuilder)
# Created by Marisa Thompson
#
---------------------------------------------------------------------------
# Import system modules
import sys, string, os, arcgisscripting
# Create the Geoprocessor object
gp = arcgisscripting.create()
# Check out any necessary licenses
gp.CheckOutExtension("spatial")
# Load required toolboxes...
gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Spatial
Analyst Tools.tbx")
# Define workspace
gp.workspace = "F:/Marisa/inputfolder"
# Define Variables
raster = "F:/Marisa/outputfolder_72/mss-72-spf.img"
#Get list of Town Shapefiles
Townshp = gp.ListFeatureClasses ("*")
#Store path to output folder
outputPath = "F:/Marisa/outputfolder_72"
# Begin going through the loop
Townshp = Townshps.next()
while Townshps !="":
#Set the output name to be the same as input
outName = outputPath + "/" + Townshp + "land" + ".img"
Output_table = outputPath + "/" + Townshp + "table" + ".dbf"
#For each extract by Mask
gp.ExtractbyMask_sa (raster, Townshp, outName)
#For each tabluate area
gp.TabulateArea_sa (Townshp, "RITOWN5K_", outName, "VALUE",
Output_table, "98.425")
Townshp = Townshps.next()
I'm extremely new to Python and programming as a whole. I have written
a python script with the assistance of ESRI ArcGIS 9.2, which uses
Python 2.4.1, however, it gives me this error when I try to run it.
I've already posted at ESRI support, and I was hoping that Python
people could help me more.
I hope there is something simple I could do to be able to define the
object that it thinks is NoneType. Please when someone responds,
please treat me as an absolute novice.
Thank you,
Marisa
Here is my code:
#
---------------------------------------------------------------------------
# towntab92.py
# Created on: Wed Dec 20 2006 11:09:59 AM
# (generated by ArcGIS/ModelBuilder)
# Created by Marisa Thompson
#
---------------------------------------------------------------------------
# Import system modules
import sys, string, os, arcgisscripting
# Create the Geoprocessor object
gp = arcgisscripting.create()
# Check out any necessary licenses
gp.CheckOutExtension("spatial")
# Load required toolboxes...
gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Spatial
Analyst Tools.tbx")
# Define workspace
gp.workspace = "F:/Marisa/inputfolder"
# Define Variables
raster = "F:/Marisa/outputfolder_72/mss-72-spf.img"
#Get list of Town Shapefiles
Townshp = gp.ListFeatureClasses ("*")
#Store path to output folder
outputPath = "F:/Marisa/outputfolder_72"
# Begin going through the loop
Townshp = Townshps.next()
while Townshps !="":
#Set the output name to be the same as input
outName = outputPath + "/" + Townshp + "land" + ".img"
Output_table = outputPath + "/" + Townshp + "table" + ".dbf"
#For each extract by Mask
gp.ExtractbyMask_sa (raster, Townshp, outName)
#For each tabluate area
gp.TabulateArea_sa (Townshp, "RITOWN5K_", outName, "VALUE",
Output_table, "98.425")
Townshp = Townshps.next()