3

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.

1
  • 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
    – BERA
    Apr 3, 2017 at 14:49

2 Answers 2

3

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.

0
1

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))
1
  • 2
    arcpy.CreateTable_management(*os.path.split(matchTable)) is pretty simple.
    – Paul
    Apr 3, 2017 at 21:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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