I've created a Spatial ETL tool from ArcGIS 10.1 and would like to run this tool to all 200 featureclasses in a geodatabase. Therefore, I've written a python script to do this automation. (btw, i'm new to arcpy) However, I get an error message stating that my featureclasses do not exist in the geodabase. It does exist though.
"Failed to execute. Parameters are not valid. 'Export1' does not exist. Failed to execute (SpatialETLTool152)"
I couldn't find any solution on the internet.
`import arcpy, os
from arcpy import env
arcpy.ImportToolbox("M:/GIS-Data/Poin2Line.tbx")
env.workspace = r"L:\\ExportLines\\Test.gdb"
FakeTide_All1_tif = r"L:\\ExportLines\\FakeTide.tif"
Test_gdb = r"L:\\ExportLines\\Test.gdb"
Destination_Comma_Separated_Value__CSV__Directory_ = r"L:\\ExportLines\\Output"
fClass = arcpy.ListFeatureClasses()
for fc in fClass:
arcpy.gp.toolbox = "M:/00-GIS-Data-4-All/Poin2Line.tbx";
#arguments (Tiff, output, input)
arcpy.gp.SpatialETLTool152("'L:\\ExportLines\\FakeTide.tif'", Destination_Comma_Separated_Value__CSV__Directory_, fc )`
1 Answer 1
I've attempted to remove the errors from your code. You had "\\" but you started the string with an r so I think python was actually seeing "\\\\" instead of "\".
Also you import a toolbox at the beginning of the script then add another within the loop which has the same name, that makes no sense so I have commented it out. But may be wanted to use that one as it is in another location?
import arcpy, os
from arcpy import env
arcpy.ImportToolbox("M:/GIS-Data/Poin2Line.tbx")
env.workspace = r"L:\ExportLines\Test.gdb"
Destination_Comma_Separated_Value__CSV__Directory_ = r"L:\ExportLines\Output"
fClass = arcpy.ListFeatureClasses()
# Whats this? You've already appeared to have imported your toolbox above
# arcpy.gp.toolbox = "M:/00-GIS-Data-4-All/Poin2Line.tbx"
for fc in fClass:
#arguments (Tiff, output, input)
arcpy.gp.SpatialETLTool152(r"L:\ExportLines\FakeTide.tif", Destination_Comma_Separated_Value__CSV__Directory_, fc )
-
Thank you for correcting and explaining my errors. I've cleaned up the scripts. It still doesn't loop through the featureclasses. I think it has to do with Spatial ETL and Model Builder. Going to work on it some more.ArcPyNewbie– ArcPyNewbie2014年07月18日 09:48:38 +00:00Commented Jul 18, 2014 at 9:48
-
For troubleshooting you could also try to loop through your feature classes without calling your tool, e.g. with
print(fc)
instead of the arcpy.gp. -call inside the for loop. Thus you can isolate what exactly fails. Also, try to call your tool from a script with only one feature class (for testing purposes).til_b– til_b2014年07月18日 11:18:09 +00:00Commented Jul 18, 2014 at 11:18
Explore related questions
See similar questions with these tags.