With help from the forum, I thought I figured out how to write a cursor to work in 9.3 and 10 but users report not.Here's my code:
import arcgisscripting, sys, os, string, traceback
gp = arcgisscripting.create(9.3)
# Set to write over previous outputs if they exist
gp.overwriteoutput = False
def which30(two6ftrcls):
two6FC = two6ftrcls
whereclause = "Two6FCs = '" + two6FC + "'"
gp.AddMessage("whereclause is " +whereclause)
crosswalk = ShellPath + "/Two630FC_IDPKxwalk.dbf"
# The variables row and rows are initially set to None, so that they
# can be deleted in the finally block regardless of where (or if)
# script fails.
row, rows = None, None
Three0ftrlst = []
FC_26namelst = []
row, rows = None, None
Three0ftrlst = []
FC_26namelst = []
rows = gp.SearchCursor(crosswalk,whereclause)
row = rows.next()
if (row == None):
gp.AddMessage("check the Two630FC_IDPKxwalk.dbf table for Two6FCs -->" +two6FC)
elif (row != None):
while row:
if not row.isNull("Three0FCs"):
Three0ftr=row.getValue("Three0FCs")
gp.AddMessage("Three0ftr is " +Three0ftr)
Three0ftrlst.append(str(Three0ftr))
FC_26name = row.getValue("FC_26")
FC_26namelst.append(str(FC_26name))
row = rows.next()
if row: del row
if rows: del rows
return Three0ftrlst, FC_26namelst
Works in 10 but not in 9.3 (so I'm told).Attached is a screenshot of the error message.