Hello. We have a python script running in Windows Task Scheduler. The script retrieves vacant parking space counts from a vendor's database through their API. The counts are updated every minute in our editable feature service, displaying the current number of vacant parking spaces in a couple of municipal parking lots. In the past few days, I noticed the counts were not updating. The script has been working since November 2019, though I don't know when it stopped. We have not edited the script since placing it into production in November 2019. ArcGIS Pro is installed on the server, we updated Pro to v 2.7 today. For troubleshooting, I ran the script manually, and noticed the following error. I am a Python novice.
Traceback (most recent call last):
File "C:\PythonScripts\free_spots_VM_testing.py", line 58, in <module>
update_result = ports_flayer.edit_features(updates=[sfo_edit])
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\features\layer.py", line 2393, in edit_features
return self._con.post(path=edit_url, postdata=params)#, token=self._token)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 720, in post
force_bytes=kwargs.pop('force_bytes', False))
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 514, in _handle_response
self._handle_json_error(data['error'], errorcode)
File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\_impl\_con\_connection.py", line 536, in _handle_json_error
raise Exception(errormessage)
Exception: Cannot perform operation. Invalid operation parameters.
This operation is not supported.
'updates' parameter is invalid
Geometry update not allowed.
(Error Code: 400)
Solved! Go to Solution.
I may have figured out the cause. In the hosted feature service Items page in AGOL, I found a geometry update option in "Settings....Editing...What kind of editing allowed?" Under 'Update,' there is a choice to include 'Attributes and geometry.' I clicked on "Manage geometry updates" and discovered the feature layer in the service was not selected. I clicked the layer on. Saved. Refreshed, ran the script and no errors. I refreshed the application in the browser and could see the vacant space counts were updating each minute and the script was now working as expected.
I may have figured out the cause. In the hosted feature service Items page in AGOL, I found a geometry update option in "Settings....Editing...What kind of editing allowed?" Under 'Update,' there is a choice to include 'Attributes and geometry.' I clicked on "Manage geometry updates" and discovered the feature layer in the service was not selected. I clicked the layer on. Saved. Refreshed, ran the script and no errors. I refreshed the application in the browser and could see the vacant space counts were updating each minute and the script was now working as expected.