GISGURU_001

My Script Tool is not working???

Discussion created by GISGURU_001 on Oct 5, 2013
I created a script tool to select features, the script tools gives me the error message below each time I run it? Help please

My Code:

import arcpy
import pythonaddins
import os
import datetime
arcpy.env.overwriteOutput = True

try:
  # Get the input parameters for the selection tool
  FeatureClass = arcpy.GetParameterAsText(0)
  SQLStatement = arcpy.GetParameterAsText(1)

  # Select by Layer Attribute
  arcpy.SelectLayerByAttribute_management(FeatureClass, "NEW_SELECTION", SQLStatement)

  # Select by Layer Attribute
  df.zoomToSelectedFeatures()

  # Report a success message 
  arcpy.AddMessage("All done!")

except:
  # Report an error messages
  arcpy.AddError("Could not complete the selection")

  # Report any error messages that the selection tool might have generated 
  arcpy.AddMessage(arcpy.GetMessages())



error message:

Executing: SelectStatement GISMainFabric_Parcels "Name = '1002'"
Start Time: Sat Oct 05 18:34:28 2013
Running script SelectStatement...
Could not complete the selection
Executing: SelectLayerByAttribute GISMainFabric_Parcels NEW_SELECTION "Name = '1002'"
Start Time: Sat Oct 05 18:34:32 2013
Succeeded at Sat Oct 05 18:34:33 2013 (Elapsed Time: 1.00 seconds)
Completed script SelectStatement...
Failed to execute (SelectStatement).
Failed at Sat Oct 05 18:34:33 2013 (Elapsed Time: 5.00 seconds)

Outcomes