AnsweredAssumed Answered

ArcGIS API for Python FeaturesLayer.append() error

Question asked by c_jermoore@PA.LCL_PADeptAG Champion on Dec 13, 2019
Latest reply on Jun 2, 2020 by

I'm having an issue with appending to a hosted feature service with a shapefile using the .append() method. I keep getting a very non-descriptive error which is:


ERROR:arcgis._impl.connection:Object reference not set to an instance of an object.
Traceback (most recent call last):
File "C:/Users/c-jermoore/Desktop/Farmland_Preservation_Scripts/DO_NOT_DELETE/AGOL_Clip_Soils_Layer_No_GUI/", line 460, in <module>
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\features\", line 1134, in append
sres = self._con.get(path=surl, params={'f' : 'json'})
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\", line 898, in get
self._handle_json_error(resp_json['error'], errorcode)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\", line 1198, in _handle_json_error
raise RuntimeError(errormessage)
RuntimeError: Object reference not set to an instance of an object.
(Error Code: 400)

I'm not exactly sure what this means. I had a suspicion that it might be due to fields not matching, which some don't but I'm mapping them in the parameters for the method. So now I'm wondering if maybe I'm not calling the FeatureLayer item correctly. 


Has anyone ever run into this before?


Here is the block of code giving me issues:


getclippedSoilsSHPItemID = agolLogin.content.get(findClippedSoilsSHPList[0])


layerToAppend = arcgis.gis.Item(gis=agolLogin, itemid="60820364b71743c49822a60da1e85492")

testAppendSoilsLayer = layerToAppend.layers[0]


                            field_mappings=[{"name": "AREASYMBOL",
                                             "source": "AREASYMBOL"},
                                            {"name": "SPATIALVER",
                                             "source": "SPATIALVER"},
                                            {"name": "MUSYM",
                                             "source": "MUSYM"},
                                            {"name": "MUKEY",
                                             "source": "MUKEY"},
                                            {"name": "Mapunit_Name",
                                             "source": "Mapunit_Na"},
                                            {"name": "Non_Irrigated_Capability_Class___Dominant_Condition",
                                             "source": "Non_Irriga"}],



Any help would be greatly appreciated