Hi All,
I have a script that works in python, but when I create a tool for it, it no longer works. I have attached the code, does anybody know what could be wrong? I have also copy and pasted the error I received. Thanks!
Executing: StreetNames "C:\Users\kziegenfuss\Desktop\PM\Segments Shapefile\Segments.shp" Street C:\Users\kziegenfuss\Desktop\PM\Clip\Clip.shp ROAD_NAME
Start Time: Fri Nov 13 07:54:58 2015
Running script StreetNames...
Failed script StreetNames...
Traceback (most recent call last):
File "C:\Users\kziegenfuss\AppData\Roaming\ESRI\Desktop10.2\ArcToolbox\My Toolboxes\StreetName.tbx#StreetNames.py", line 29, in <module>
File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\management.py", line 6812, in SelectLayerByLocation
raise e
ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000368: Invalid input data.
Failed to execute (SelectLayerByLocation).
Failed to execute (StreetNames).
Failed at Fri Nov 13 08:02:24 2015 (Elapsed Time: 7 minutes 26 seconds)
Solved! Go to Solution.
The error indicates there is a problem with your inputs for the select layer by location. You need to generate a layer from the buffer in your script. The select layer by location will only take layer files not output features.
#buffer the dissolved Centerlines layer arcpy.Buffer_analysis ("lyr_dissolved", "buffer", "50 Feet", "", "", "", "") arcpy.MakeFeatureLayer_management("buffer", "lyr_buffer") #Delete any centerlines that will not be used arcpy.SelectLayerByLocation_management("lyr_buffer","INTERSECT","lyr_Segments","","NEW_SELECTION")
What are the parameters for the tool? a screen grab or documentation of the parameter, type, etc would be useful
The parameters two shapefiles and a specified field from each shapefile
The error indicates there is a problem with your inputs for the select layer by location. You need to generate a layer from the buffer in your script. The select layer by location will only take layer files not output features.
#buffer the dissolved Centerlines layer arcpy.Buffer_analysis ("lyr_dissolved", "buffer", "50 Feet", "", "", "", "") arcpy.MakeFeatureLayer_management("buffer", "lyr_buffer") #Delete any centerlines that will not be used arcpy.SelectLayerByLocation_management("lyr_buffer","INTERSECT","lyr_Segments","","NEW_SELECTION")