AnsweredAssumed Answered

ValureError - Circular reference when publishing to an ArcGIS server using the python api 1.4.2

Question asked by MaLewisesriuk-esridist Employee on Jul 12, 2018

Has anyone had a circular reference issue when publishing to an ArcGIS server using the python api 1.4.2? The information of the issue is below.

Git Hub RefValueError - Circular Reference - gis.admin.servers Publish SD · Issue #270 · Esri/arcgis-python-api · GitHub 

What i'm trying to do - Publish a MapImageSD file to the ArcGIS Server.

Problem - Publishing an SD file to the arcgis enterprise server causes a ValueError: Circular Reference Detected. The circular reference occurs in the module _connection.py on line 198. Here a json.dumps(val) method id failing. The "val" response variable is returning

{'f': 'json', 'in_config_overwrite': '', 'in_publish_options': '', 'in_sdp_id': <Recursion on dict with id=1988743734832>, 'self': <Toolbox url:"https://[domain]/arcgis/rest/services/System/PublishingTools/GPServer">}

'in_sdp_id' seems to be causing the issue.

Code
gis = GIS(config["gis"]["portal_url"], config["gis"]["username"], config["gis"]["password"]) gis_servers = gis.admin.servers.list() server1 = gis_servers[0] server1.services.publish_sd(sd_file='C:/Projects/TestOutput/MapImageSharingDraftExample.sd', folder=None)

Output:

Traceback (most recent call last): File "c:\Projects\project\Phase 1\repositories\Automation\content\createContent.py", line 118, in <module> build(config=json_config, username=username, password=password) File "c:\Projects\project\Phase 1\repositories\Automation\content\createContent.py", line 54, in build folder=None) File "C:\anaconda3\envs\project\lib\site-packages\arcgis\gis\server\admin\_services.py", line 252, in publish_sd return self._sm.publish_sd(sd_file, folder) File "C:\anaconda3\envs\project\lib\site-packages\arcgis\gis\server\admin\administration.py", line 181, in publish_sd res = service.publish_service_definition(in_sdp_id=uid) File "C:\anaconda3\envs\project\lib\site-packages\arcgis\geoprocessing\_tool.py", line 97, in publish_service_definition return self._execute(kwargs) File "C:\anaconda3\envs\project\lib\site-packages\arcgis\geoprocessing\_tool.py", line 989, in _execute job_info = self._con.post(submit_url, gp_params, token=self._token) File "C:\anaconda3\envs\project\lib\site-packages\arcgis\gis\server\_common\_connection.py", line 864, in post postdata = {k: jsonize_dict(v) for k, v in postdata.items()} File "C:\anaconda3\envs\project\lib\site-packages\arcgis\gis\server\_common\_connection.py", line 864, in <dictcomp> postdata = {k: jsonize_dict(v) for k, v in postdata.items()} File "C:\anaconda3\envs\project\lib\site-packages\arcgis\gis\server\_common\_connection.py", line 198, in jsonize_dict return json.dumps(val) File "C:\anaconda3\envs\project\lib\json\__init__.py", line 231, in dumps return _default_encoder.encode(obj) File "C:\anaconda3\envs\project\lib\json\encoder.py", line 199, in encode chunks = self.iterencode(o, _one_shot=True) File "C:\anaconda3\envs\project\lib\json\encoder.py", line 257, in iterencode return _iterencode(o, 0) ValueError: Circular reference detected

Outcomes