I'm trying to create a script tool in ArcMap that creates an attachment match table. The script fails giving this:
Traceback (most recent call last):
File "H:\py\PhotoMatch_test.py", line 40, in <module>
arcpy.CreateTable_management(outputGdb, matchTable)
File "c:\program files\arcgis\desktop10.2\arcpy\arcpy\management.py", line 14419, in CreateTable
raise e
ExecuteError: ERROR 999999: Error executing function.
Failed to execute (CreateTable).
My code looks like this:
import arcpy, sys
inputFeatures = arcpy.GetParameterAsText(0)
picfolder = arcpy.GetParameterAsText(1)
matchTable = arcpy.GetParameterAsText(2)
outputGdb = arcpy.env.scratchGDB
arcpy.CreateTable_management(outputGdb, matchTable)
The parameter properties of the script tool: enter image description here
I'm obviously a beginner.
-
2The parameters in the script tool need to be in the same order(/index?) as they appear in the script. So move the parameter 'Input features' to the top using the arrows to the rightBera– Bera2017年04月03日 14:49:51 +00:00Commented Apr 3, 2017 at 14:49
2 Answers 2
The parameters in the script tool need to be in the same order(/index?) as they appear in the script. So move the parameter Input features
to the top using the arrows to the right.
Also from what i can see in your code you are not using the picfolder
parameter.
The problem was bad parameters passed to arcpy.CreateTable_management. I needed a path and a name, but I had given two full paths, which may not have even matched. Here's the change:
outputGdb = os.path.dirname(matchTable)
arcpy.CreateTable_management(outputGdb, os.path.basename(matchTable))
-
2
arcpy.CreateTable_management(*os.path.split(matchTable))
is pretty simple.Paul– Paul2017年04月03日 21:04:59 +00:00Commented Apr 3, 2017 at 21:04