I am very new to Python and scripting and am trying to write script to delete any point feature classes in my .gdb. I have found an example, but can't get it to run. Your help is greatly appreciated.
import arcpy
arcpy.env.workspace = r"E:\GIS_255\Week5\Harmon_Wk5_GIS255\KingCounty.gdb"
import string
try:
fcList = arcpy.ListFeatureClasses("","point", "")
for fc in fcList:
Lst = arcpy.Describe(fc)
if string.lower(Lst.shapeType) == "point":
print str(fc) + " is a " + Lst.shapeType + " feature class"
else:
print str(fc) + "The shapetype is unknown"
except:
print "Script failed"
# Set local variables
inFeatures = "points"
outFeatures = r"E:\GIS_255\Week5\Harmon_Wk5_GIS255\output.gdb\new_points"
tempLayer = "pointsLayer"
expression = arcpy.AddFieldDelimiters(pointsLayer, "Point_ID") + " = 'busstop'" + " = 'bridges'"
try:
# Execute CopyFeatures to make a new copy of the feature class
arcpy.CopyFeatures_management(inFeatures, outFeatures)
# Execute MakeFeatureLayer
arcpy.MakeFeatureLayer_management(outFeatures, tempLayer)
# Execute SelectLayerByAttribute to determine which features to delete
arcpy.SelectLayerByAttribute_management(tempLayer, "NEW_SELECTION",
expression)
# Execute GetCount and if some features have been selected, then
# execute DeleteFeatures to remove the selected features.
if arcpy.GetCount_management(tempLayer) > 0:
arcpy.DeleteFeatures_management(tempLayer)
except Exception, e:
# If an error occurred, print line number and error message
import traceback, sys
tb = sys.exc_info()[2]
print "Line %i" % tb.tb_lineno
print e.message