I'm trying to loop through a directory of shp files with an XTool Pro tool via arcpy. My script successfully performs the operation on the first shp file, but then fails on the rest with a 000584 error "Implementation of this Tool's Validate is invalid" Here is my script:
import arcpy, os
from arcpy import env
arcpy.env.workspace = r"C:\Data_State\MT\temp"
arcpy.AddToolbox("C:/Program Files (x86)/DataEast/XTools Pro/Toolbox/XTools Pro.tbx")
for fc in arcpy.ListFeatureClasses():
arcpy.XToolsGP_AddXYZ_xtp(fc,"X longitude;Y latitude","CENTER","GEOGCS['GCS_WGS_1984',DATUM['D_WGS84',SPHEROID['WGS84',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]","NONE")
Does anyone know why the tool is unable to loop through the files?
Updated script and I'm still having the same issue
import arcpy, os
from arcpy import env
arcpy.env.workspace = r"C:\Data_State\MT\temp"
arcpy.AddToolbox("C:/Program Files (x86)/DataEast/XTools Pro/Toolbox/XTools Pro.tbx")
for fc in arcpy.ListFeatureClasses():
if fc.endswith(".shp"):
try:
print(fc)
arcpy.RepairGeometry_management(fc)
print(fc + " Parcels Repaired")
except:
print(fc + " repair failed.")
for fc in arcpy.ListFeatureClasses():
if fc.endswith(".shp")
try:
arcpy.XToolsGP_AddXYZ_xtp(fc,"X longitude;Y latitude","CENTER","GEOGCS['GCS_WGS_1984',DATUM['D_WGS84',SPHEROID['WGS84',6378137.0,298.257223563]],PRIMEM['Greenwich',0.0],UNIT['Degree',0.0174532925199433]]","NONE")
except:
print(fc + " failed.")