I am trying to create a script tool in ArcGIS Pro that uses 2 clipping feature classes to clip multiple other feature classes and save them to two new geodatabases I create in the script.
I use 6 parameters as GetParameterAsText to specify the conditions:
- sourceWorkspace (0)
- ClipFC_North (1)
- ClipFC_South (2)
- out_folder_path (3)
- out_gdb_N (4)
- out_gdb_S (5)
Below that I try to create the new geodatabases:
arcpy.CreateFileGDB_management(out_folder_path, out_gdb_N)
arcpy.CreateFileGDB_management(out_folder_path, out_gdb_S)
Thats where my script fails and doesn't continue to clip the feature classes in the source geodatabase.
What am I doing wrong? Here is my code up to the point it fails as a script tool.
import arcpy
out_folder_path = arcpy.GetParameterAsText(0)
out_gdb_N = arcpy.GetParameterAsText(1) # North.gdb
out_gdb_S = arcpy.GetParameterAsText(2) # South.gdb
sourceWorkspace = arcpy.GetParameterAsText(3)
clipFC_N = arcpy.GetParameterAsText(4)
clipFC_S = arcpy.GetParameterAsText(5)
print(out_folder_path, out_gdb_N, out_gdb_S)
# Execute CreateFileGDBs
arcpy.CreateFileGDB_management(out_folder_path, out_gdb_N)
arcpy.CreateFileGDB_management(out_folder_path, out_gdb_S)
Here is the error message I get:
Start Time: Friday, December 4, 2020 11:28:44 PM
Failed script ClipScript...Traceback (most recent call last):
File "D:\Dan_GIS\Programming\DAN_Scripts\SH_36.py", line 21, in <module>
arcpy.CreateFileGDB_management(out_folder_path, out_gdb_N)
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\management.py", line 21978, in CreateFileGDB
raise e
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\management.py", line 21975, in CreateFileGDB
retval = convertArcObjectToPythonObject(gp.CreateFileGDB_management(*gp_fixargs((out_folder_path, out_name, out_version), True)))
File "c:\program files\arcgis\pro\Resources\arcpy\arcpy\geoprocessing\_base.py", line 511, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: ERROR 999999: Something unexpected caused the tool to fail. Contact Esri Technical Support (http://esriurl.com/support) to Report a Bug, and refer to the error help for potential solutions or workarounds.
Failed to execute (CreateFileGDB).
Failed to execute (JasonClipScript).
Failed at Friday, December 4, 2020 11:28:45 PM (Elapsed Time: 0.69 seconds)
out_gdb_*
are probably full paths not just filenames, first thing to check is what your parameter values are witharcpy.AddMessage(out_gdb_N)
etc...