I had the following working last week but it's failing today. If it ends up being caused by a change on my side, I'll certainly come clean and post the solution here ... but I don't think anything has changed on my side.
That said, I have the following code in a notebook
PSAP='Template'
file_path = "C:\\LocalDocuments\\files\\file1\\"+PSAP+".geojson"
geojson = gis.content.add({
"type": "GeoJson",
"title": 'PSAP '+PSAP+" TEST Layer",
"tags": [PSAP,"TEST"]
}, data=file_path)
geojsonlyr_item = geojson.publish()
And it fails on the publish() with the following error:
Exception Traceback (most recent call last)
In [106]:
Line 1: lyr_item = geojson.publish()
File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py, in publish:
Line 10356: serviceitem_id = self._check_publish_status(ret, folder)
File C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py, in _check_publish_status:
Line 10583: raise Exception("Job failed.")
Exception: Job failed.
Now what is weird is that if I go to AGOL , the new Layer actually DOES get successfully published?!?
Also, just as a test if I delete the layer in AGOL I can select the GeoJSON item I added in step 2 and successfully publish it without error.
Am I doing something wrong in my publish() call?