我创建了一个简单的脚本来将.dbf加入.shp,然后计算几个字段。该脚本效果很好,但如果由于某种原因没有连接,我会遇到以下错误,它会在尝试将剩余的.dbf添加到我的工作目录中的.shp连接之前关闭该脚本。我如何告诉脚本忽略不加入的.shps,并继续处理目录中剩余的.shps?使用错误执行function.An无效SQL语句:将.dbf加入.shp - 然后计算字段脚本 - 错误处理,脚本退出时没有加入
线20,在 gp.CalculateField_management( “PARCS”, “APN2”, “[TAX.PARCEL_ID]”) ExecuteError:ERROR 999999。 使用了无效的SQL语句。
下面是脚本:
# Create the geoprocessor object
gp = arcgisscripting.create(9.3)
gp.OverWriteOutput = True
# Set the workspace. List all of the folders within
gp.Workspace = "C:\JoinCalculateBatch"
fcs = gp.ListWorkspaces("*","Folder")
for fc in fcs:
print fc
gp.MakeFeatureLayer(fc + "\\Parcels.shp", "parcs")
joinTable = (fc + "\\TAX.dbf")
gp.AddJoin_management("parcs", "APN", joinTable, "PARCEL_NUM")
gp.CalculateField_management("parcs", "APN2", "[TAX.PARCEL_ID]")
gp.CalculateField_management("parcs", "SIT_FULL_S", "[TAX.SITADDRESS]")
感谢您的帮助,我应该知道这一点。 –