AddJoin_management python script error

2915
2
12-03-2016 04:54 PM
DineshChalasani
New Contributor

I have two shape files and want to join both attribute tables with common field. But arcpy throws the following error.

arcpy.management.AddJoin(output_feature, "AccountPoi", lstfc1[x1-1], "AccountID", "KEEP_COMMON")

Traceback (most recent call last):  File "C:/Users/dxc163530/PycharmProjects/start_charm.py", line 48, in <module>    arcpy.management.AddJoin(output_feature, "AccountPoi", lstfc1[x1-1], "AccountID", "KEEP_COMMON")  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 5096, in AddJoin    raise e   File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 5093, in AddJoin    retval = convertArcObjectToPythonObject(gp.AddJoin_management(*gp_fixargs((in_layer_or_view, in_field, join_table, join_field, join_type), True)))  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 506, in <lambda>    return lambda *args: val(*gp_fixargs(args, True))arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.The value cannot be a feature classERROR 000840: The value is not a Raster Layer.ERROR 000840: The value is not a Mosaic Layer.WARNING 000970: The join field AccountPoi in the join table AccountPoints is not indexed. To improve performance, we recommend that an index be created for the join field in the join table.Failed to execute (AddJoin). Process finished with exit code 1
0 Kudos
2 Replies
DanPatterson_Retired
MVP Esteemed Contributor

Add Join—Help | ArcGIS for Desktop specifies the required types of inputs.

What are the values that are required for the following.

AddJoin_management (in_layer_or_view, in_field, join_table, join_field, {join_type})

The data requirements are specific and it isn't possible to tell from your error message due to formatting

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Originally posted this accidentally on the duplicate thread, reposting here instead.  It basically states what Dan already says.  We basically need to know more about the arguments you are passing.

Both the error code ( 000840: The value is not a <value> ) and text are saying an incorrect parameter/argument is being passed to the Add Join tool.  Looking at the syntax of the Add Join tool,

AddJoin_management (in_layer_or_view, in_field, join_table, join_field, {join_type})‍‍‍

and what you passed:

AddJoin(output_feature, "AccountPoi", lstfc1[x1-1], "AccountID", "KEEP_COMMON")‍‍‍

Since the in_field, join_field, and join_type parameters expect strings and you passed strings; the issue is either with output_feature or lstfcl[x1-1].  Can you elaborate on what is behind those two variables?

0 Kudos