Hi,
Very new to Python. I created a small script to compare data from two tables and create a third table containing the results of the comparison (a "results_table" that the user will define). It works when I run the code through my IDE, but when running the tool I receive the following error:
ERROR 000354: The name contains invalid characters
Failed to execute (CreateTable).
Here is how I am defining the parameters:
Excerpts from the code:
import arcpy
arcpy.env.overwriteOutput=1
workspace = arcpy.GetParameterAsText(0)
arcpy.env.workspace = workspace
feature_class = arcpy.GetParameterAsText(1)
standards_table = arcpy.GetParameterAsText(2)
feature_id_field = arcpy.GetParameterAsText(3)
s_field = arcpy.GetParameterAsText(4)
results_table = arcpy.GetParameterAsText(5)
# CODE......
arcpy.management.CreateTable(workspace, results_table)
Any help would greatly appreciated. Thanks!!
Solved! Go to Solution.
CreateTable takes two arguments: The output workspace and the output name. Your last parameter is a Table, if you get that as text, it returns the table path. If you use that in CreateTable, it tries to create a table with the complete path as name. This puts illegal characters ("\") into the table name.
If you make the last parameter a String, it should work.
CreateTable takes two arguments: The output workspace and the output name. Your last parameter is a Table, if you get that as text, it returns the table path. If you use that in CreateTable, it tries to create a table with the complete path as name. This puts illegal characters ("\") into the table name.
If you make the last parameter a String, it should work.
Making it a String parameter worked perfectly. Thanks, Johannes!