Select to view content in your preferred language

ARCGIS API for Python Save Feature Set to Feature Class not working since ArcGis Pro 3.3 Upgrade

406
1
07-04-2024 02:52 AM
GeorgeJoubert
Occasional Contributor

Hi All,

I am fairly new on the blog, so hope I explain the problem correctly.

I have been using the Save Feature Set to Feature Class function in ARGIS API for Pyhton and be using it to do change tracking of data that is updated on our Enterprise Portal. It has been running fine up to the Point where I updated to ArcGIS Pro 3.3

I am not sure if something changed in arcpy or is it a bug.

Works on:

arcgis 2.2.0.1

arcgispro 3.2

arcpy 3.2

Does not work on:

arcgis 2.3.0

arcgispro 3.3

arcpy 3.3

Error:

MV_Panel_xRackablex_Survey123: https://portal/server/rest/services/Hosted/service_012ff3e23a284e41a8cf7bb6133b372d/FeatureServer/0

MV_Panel_xRackablex_Survey123

---------------------------------------------------------------------------

ExecuteError                              Traceback (most recent call last)

In  [3]:

Line 13:    fs.save(fgdb, 'ZZZTemp_' + s)  #Temp Disabled

 

File C:\Users\username\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\Lib\site-packages\arcgis\features\feature.py, in save:

Line 1455:  res = json_to_featureclass(

 

File C:\Users\username\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone\Lib\site-packages\arcgis\_impl\common\_spatial.py, in json_to_featureclass:

Line 30:    return arcpy.JSONToFeatures_conversion(

 

File C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\conversion.py, in JSONToFeatures:

Line 1095:  raise e

 

File C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\conversion.py, in JSONToFeatures:

Line 1092:  retval = convertArcObjectToPythonObject(gp.JSONToFeatures_conversion(*gp_fixargs((in_json_file, out_features, geometry_type), True)))

 

File C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\geoprocessing\_base.py, in <lambda>:

Line 512:   return lambda *args: val(*gp_fixargs(args, True))

 

ExecuteError: ERROR 001558: Error parsing json file 'C:\Users\username\AppData\Local\Temp\ArcGISProTemp17344\5ae7cb07306747ab93f86f82c8422145.json'. A row with this OID already exists. [ScratchRecordSet]

Failed to execute (JSONToFeatures).

 

The original post where I got the Python code from:

https://community.esri.com/t5/python-questions/using-arcpy-to-copy-a-portal-feature-service-to-a/td-...

I have script a loop through all feature service layers, but it fails on the save of the first one. Uninstalling ArcGIS Pro 3.3 and Reinstalling Pro 3.2 did resolve the issue.

0 Kudos
1 Reply
David_McRitchie
Esri Contributor

Hey George,

I tried getting this working but was facing a some issues with the script. I instead came across the following sample which seems to work at 3.3

Hope that helps,

David

Esri UK -Technical Support Analyst
0 Kudos