Geographic Information Systems Asked by DanH on December 6, 2020
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:
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_GISProgrammingDAN_ScriptsSH_36.py", line 21, in <module>
arcpy.CreateFileGDB_management(out_folder_path, out_gdb_N)
File "c:program filesarcgisproResourcesarcpyarcpymanagement.py", line 21978, in CreateFileGDB
raise e
File "c:program filesarcgisproResourcesarcpyarcpymanagement.py", line 21975, in CreateFileGDB
retval = convertArcObjectToPythonObject(gp.CreateFileGDB_management(*gp_fixargs((out_folder_path, out_name, out_version), True)))
File "c:program filesarcgisproResourcesarcpyarcpygeoprocessing_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)
The problem is with your input parameter TYPES. To understand this you need to read the syntax section of Create File GeoDatabase tool in the help file.
What are the parameter types for the output path and out_name? They are of type Folder and string respectively.
You have set your out_gdb_N
and out_gdb_S
to both be workspaces not strings.
They need to be simply strings, the name of the geodatabase which will go into your output folder.
Better still don't take my word for it, try using your mouse to scroll the help page down to the code section of ANY tool and you will see some simple sample code using the tool, the rest you can work out.
Answered by Hornbydd on December 6, 2020
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP