I am using ArcPy 2.7 to subset a shapefile. I am trying to use arcpy.Select_analysis to exclude certain features from a shapefile (idle fields denoted as 1401 in the field 'Crop_Type'. my 'Crop_Type' field is of type long.
I'm receiving the following error: ExecuteError: ERROR 000358: Invalid expression NOT "Crop_Type" = '1401'
Looking at ESRI's Building a SQL Expression, my code is:
import arcpy
from arcpy.sa import *
arcpy.env.overwriteOutput = True
in_features = 'Copy_SaltonT4_2017.shp'
out_feature_class = 'CroppedFields.shp'
where_clause = 'NOT "Crop_Type" = \'1401\''
arcpy.Select_analysis(in_features, out_feature_class, where_clause)
arcpy.CopyFeatures_management(in_features, out_feature_class)