Migrating code from ArcGIS Desktop python 2.7.3 to ArcGIS Pro python 3.6.2

1481
4
Jump to solution
07-18-2018 12:25 AM
SyedGardezi
New Contributor II

I am calling the following function:

import arcpy
arcpy.JoinField_management(in_data,in_field,join_table,join_table_field,fields)

It works perfectly fine using ArcGIS Desktop python 2.6 but gives the following trace using ArcGIS Pro python arcgispro-py3

input parameters:
  arcpy.JoinField_management(
  temp_layer,
  NEAR_FID,
  xyz.gdb\xyz\xyz,
  OBJECTID,
  dict_values(['xyz']
)

Traceback (most recent call last):
    arcpy.JoinField_management(in_data,in_field,join_table,join_table_field,fields)
    raise e
    retval = convertArcObjectToPythonObject(gp.JoinField_management(*gp_fixargs((in_data, in_field, join_table, join_field, fields), True)))
    return lambda *args: val(*gp_fixargs(args, True))
RuntimeError: Object: Error in executing tool

I check I passed exactly  the same varabiels to both function but I am getting this error. can you give soem hints as to what might be the issue?

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
DanPatterson_Retired
MVP Emeritus

/blogs/dan_patterson/2016/08/14/script-formatting  rather than screen grabs

should be used to check for 2 to 3 changes in tool parameters etc

View solution in original post

4 Replies
DanPatterson_Retired
MVP Emeritus

/blogs/dan_patterson/2016/08/14/script-formatting  rather than screen grabs

should be used to check for 2 to 3 changes in tool parameters etc

SyedGardezi
New Contributor II

Thanks Dan Patterson, gdb name wasnt unicode string for Pythin 3! Fixing it solved the issue. Thanks for sharing the tool I will use it.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Is this code being run in the interactive Python window of ArcMap and ArcGIS Pro or standalone script?

0 Kudos
SyedGardezi
New Contributor II

Its standalone script.

0 Kudos