I'm trying to write a simple selection tool which works just fine in the Python window in ArcMap but when I create a tool with it, it says that it runs successfully but nothing happens. The script is designed to create a layer file called locations_lyr from a file geodatabase feature class called locations. It then selects entities where Facility_Type = School and refreshes the ArcMap display. The script is as follows:
import arcpy import os from arcpy import env #set workspace Workspace = arcpy.GetParameterAsText(0) env.workspace = r"D:\GIS Data\Selection Test\Temp_OP.gdb" env.overwriteOutput = 1 arcpy.MakeFeatureLayer_management("Locations","locations_lyr") arcpy.SelectLayerByAttribute_management(in_layer_or_view="locations_lyr",selection_type="NEW_SELECTION",where_clause="Facility_Type = 'School'") arcpy.RefreshActiveView()
If I load it in the Python console, it works just fine. I've added it as a tool called SelectSchools in a new toolbox called Selection using the Add Script wizard and that all seems to work just fine. When I run the tool, it says it ran successfully but nothing happens. I've tried adding Print statements at various points in the script but they are not displayed. Any suggestions would be appreciated!