Closed vassilo closed 2 years ago
Can you post the code to reproduce this?
from arcgis.gis import GIS
gisEnvironment = GIS(AGOL Account connection) try: userObject = gisEnvironment.users.create(username = 'test_esri_southafrica', password = 'Test@123', firstname = 'Test', lastname = 'Test', email = 'test@email.com', role = 'org_publisher', provider='arcgis', level=2, user_type = 'creatorUT', credits = 10 ) except Exception as error: print(error)
This one gives me a similar error around groups. In my original code I had added the user to a group so I didn't see this error, but it is the same. It is a key error looking for self.user_settings['groups'] which does exist. This is basically the same as the userType error, it just hasn't gotten there yet.
The issue occurs for the group at line 2512 for the init.py file, and at 2552 for the userType error.
Regards, Vassilo.
I cannot reproduce the issue on my end. Do you have New Member Defaults
set on your org?
No I don't.
Ok, we did some updates at the next release. I think it might be in the pre-release.
Try updating in a new conda channel: conda install -c esri/label/prerelease arcgis
Let me know if that fixes the issue.
I am still getting the errors, both with the sample program I sent, and with the full program. Here is the full trace from the userType keyerror.
Unable to display children:Error resolving variables Traceback (most recent call last): File "D:/OneDrive/Esri/Scripts/Python/AGOL_Bulk_Users/AGOL_Bulk_Users.py", line 187, in CreateUser groups = group File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis__init__.py", line 2275, in create return self._create64plus(**params) File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis__init__.py", line 2584, in _create64plus if not self.user_settings['userType'] == 'arcgisonly': KeyError: 'userType'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.3\plugins\python-ce\helpers\pydev_pydevd_bundle\pydevd_resolver.py", line 213, in resolve return dict[key] KeyError: 'KeyError'
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.3\plugins\python-ce\helpers\pydev_pydevd_bundle\pydevd_comm.py", line 1232, in do_it _typeName, val_dict = pydevd_vars.resolve_compound_variable_fields(self.thread_id, self.frame_id, self.scope, self.attributes) File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.3\plugins\python-ce\helpers\pydev_pydevd_bundle\pydevd_vars.py", line 282, in resolve_compound_variable_fields var = getVariable(thread_id, frame_id, scope, attrs) File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.3\plugins\python-ce\helpers\pydev_pydevd_bundle\pydevd_vars.py", line 240, in getVariable var = resolver.resolve(var, k) File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.1.3\plugins\python-ce\helpers\pydev_pydevd_bundle\pydevd_resolver.py", line 215, in resolve return getattr(dict, key) AttributeError: 'dict' object has no attribute 'KeyError'
Cannot reproduce. Tested with v2.0.0 and ArcGIS Online. The user was successfully created with the code provided
When using the API (1.8.2) to create a user in AGOL, it throws an exception only indicating userType. On further investigation seems that when trying to query the user_settings it can't find the key userType and therefore fails. This happens after it has already created the user in AGOL.