AnsweredAssumed Answered

Error accessing Workforce project

Question asked by mstarry_mnpower on Aug 18, 2020
Latest reply on Aug 18, 2020 by mstarry_mnpower

I am trying to access a Workforce project (new version) using the ArcGIS API for Python. I have upgraded ArcGIS Pro to version 2.6, cloned the default environment, and updated the arcgis package to 1.8.2.

 

Here is my code:

import arcgis

org_url = 'orgurlhere'
un = 'myUn'
pw = 'myPw'
itemId = 'itemid' #Service ItemId

gis = arcgis.gis.GIS(org_url,un,pw)

item = gis.content.get(itemId)
project = arcgis.apps.workforce.Project(item)

I get the following error:

Traceback (most recent call last):
File "C:\myscripts\test_wf.py", line 11, in <module>
project = arcgis.apps.workforce.Project(item)
File "C:\Users\myun\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone2\lib\site-packages\arcgis\apps\workforce\project.py", line 45, in __init__
self._assignment_schema = AssignmentSchema(self.assignments_layer)
File "C:\Users\myun\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone2\lib\site-packages\arcgis\_impl\common\_utils.py", line 158, in _lazy_property
setattr(self, attr_name, fn(self))
File "C:\Users\myun\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone2\lib\site-packages\arcgis\apps\workforce\project.py", line 233, in assignments_layer
return FeatureLayer(self.assignments_layer_url, self.gis)
File "C:\Users\myun\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone2\lib\site-packages\arcgis\apps\workforce\project.py", line 183, in assignments_layer_url
return self._item_data['assignments']['url']
KeyError: 'assignments'

 

I am just starting out with the ArcGIS API for Python but this seems pretty basic. Does anyone have any ideas what might be wrong here?

Outcomes