When I run this: arcpy.management.JoinField("gssurgo_poly","MUKEY","M:/public/fw3540_labs/2022/lab7/gSSURGO_MI.gdb/mapunit","Mapunit key",["Legend Key","Mapunit Key","Mapunit Name","Mapunit Symbol"])
I get the dreaded 9's, and nothing changes in my table.
When I run this (note I have changed from Alias to Field Name): arcpy.management.JoinField("gssurgo_poly","MUKEY","M:/public/fw3540_labs/2022/lab7/gSSURGO_MI.gdb/Mapunit","Mapunit key",["mukey","lkey","musym","muname"])
I get the dreaded 9's, but the four fields populate as Null values.
When I run this: arcpy.management.AddJoin("gssurgo_poly","MUKEY","M:/public/fw3540_labs/2022/lab7/gSSURGO_MI.gdb/Mapunit","Mapunit key")
All the fields populate as Null values
When I run it in the tool:
Runs like a dream.
Just a bug, or am I missing something obvious?
I get similar issues with AddJoin. Works fine in the tool. In the python script, I get ERROR 160637: The name of an entry in the CodedValueDomain is empty.
And then, after importing the table, still no dice:
arcpy.management.JoinField("gssurgo_poly","MUKEY","Mapunit","Mapunit key")
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 9027, in JoinField
raise e
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 9024, in JoinField
retval = convertArcObjectToPythonObject(gp.JoinField_management(*gp_fixargs((in_data, in_field, join_table, join_field, fields, fm_option, field_mapping), True)))
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Join Table: Dataset Mapunit does not exist or is not supported
Failed to execute (JoinField).
arcpy.management.JoinField("gssurgo_poly","MUKEY","Mapunit","mukey")
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 9027, in JoinField
raise e
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\management.py", line 9024, in JoinField
retval = convertArcObjectToPythonObject(gp.JoinField_management(*gp_fixargs((in_data, in_field, join_table, join_field, fields, fm_option, field_mapping), True)))
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py", line 512, in <lambda>
return lambda *args: val(*gp_fixargs(args, True))
arcgisscripting.ExecuteError: Failed to execute. Parameters are not valid.
ERROR 000732: Join Table: Dataset Mapunit does not exist or is not supported
Failed to execute (JoinField).
when running from a tool or in the python window, the current workspace is known.
If you are using a separate python ide, it is best to specify the workspace, eg.
arcpy.env.workspace = "C:/data/data.gdb"
assuming "gssurgo_poly" is in that geodatabase and your other file requires a full path to locate it
or specify the full paths to both
Dan, thank you for this. I noticed in my code that I didn't take into account that the tables are in the parent folder and the feature class is within the child folder. Re-ran, without success, but will jump back in once if I have the time.
You're using an alias as join field ("Mapunit key"), that might be the problem. Try with the actual field name.
If you can run it from the tool, then go to the geoprocessing history, right-click on the successfull tool run, send the code to the Python Window, and analyze the command.
Good thought! Thank you. I will jump back in and check out the tool history. I figured there was a way to see the command line history, but wasn't quite sure where to look.
I'm not OP, but changing from field alias to the actual field name solved this issue for me
(ERROR 160637: The name of an entry in the CodedValueDomain is empty.)
Thanks!