1

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)

Script Tool Properties

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)
1
  • 2
    out_gdb_* are probably full paths not just filenames, first thing to check is what your parameter values are with arcpy.AddMessage(out_gdb_N) etc... – user2856 Dec 5 '20 at 7:17
1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.