Skip to main content

Using ArcGIS Notebooks in ArcGIS Online (AGOL), I've been able to create users as an admin with the following code from this documentation:

from arcgis.gis import GIS
gis = GIS("home")
gis.users.create(username='TESTTWO@newwestcity.ca',
                     password=None,
                     firstname='TEST',
                     lastname='TWO',
                     email='gis@newwestcity.ca',
                     user_type='Creator',
                     role='org_user',
                     groups=None)

However, when I try this code using PythonCreator, according to this example:

from arcgis.gis import GIS
 
def FeatureCreator(feature):
    gis = GIS(profile="gis_services1")    
    gis.users.create(username='TESTTHREE@newwestcity.ca',
                     password=None,
                     firstname='TEST',
                     lastname='THREE',
                     email='gis@newwestcity.ca',
                     description='TEST USER',
                     user_type='Creator',
                     level=2,
                     role='org_user',
                     provider='arcgis',
                     groups=None
                    )

I get the following error after running the transformer:

Python version 3.6 loaded successfully
Adding folder `H:\MapLibrary_ArcGISOnline\_Admin\InformationTechnologyServices\addusers_pythonapi\FME\' to the python path
Reading...
Emptying factory pipeline
Router and Unexpected Input Remover (RoutingFactory): Tested 0 input feature(s), wrote 0 output feature(s): 0 matched merge filters, 0 were routed to output, 0 could not be routed.
Unexpected Input Remover Nuker (TeeFactory): Cloned 0 input feature(s) into 0 output feature(s)
CSV_CSV2_1 Splitter (TeeFactory): Cloned 0 input feature(s) into 0 output feature(s)
Python Exception <KeyError>: 'groups'
Error encountered while calling function `FeatureCreator'
PythonCreator (PythonFactory): PythonFactory failed to process feature
PythonCreator (PythonFactory): A fatal error has occurred. Check the logfile above for details
PythonCreator_Creator (CreationFactory): A fatal error has occurred. Check the logfile above for details
A fatal error has occurred. Check the logfile above for details
Translation FAILED with 6 error(s) and 0 warning(s) (0 feature(s) output)
FME Session Duration: 21.3 seconds. (CPU: 5.4s user, 12.1s system)
END - ProcessID: 10044, peak process memory usage: 306572 kB, current process memory usage: 290600 kB
A fatal error has occurred. Check the logfile above for details
Program Terminating
Translation FAILED.

I've looked into several community posts without success:

 

From the logs, it looks like the issue is with groups argument.  Looking at this documentation, the description for Groups is 'Optional List. An array of Group objects to provide access to for a given user. (10.7+)'.

 

I'm using FME Desktop 2021.1 with Esri ArcGIS Python 3.6+ as the Python Interpreter. 

 

That's all the info I have for now, thank you in advance.

If it's optional can you simply leave it off (the groups argument)? It's not a great solution, especially if you want to use the groups but if you don't need the groups then I think you can just leave it off.

Which version of ArcGIS are you running? If the version is older than 10.7 it will not recognise the 'groups' key.


If it's optional can you simply leave it off (the groups argument)? It's not a great solution, especially if you want to use the groups but if you don't need the groups then I think you can just leave it off.

Which version of ArcGIS are you running? If the version is older than 10.7 it will not recognise the 'groups' key.

Hi @virtualcitymatt​,

 

Thanks for the reply. I tried your suggestion and removed the groups argument but the same error was returned.

 

groups_translationerrorI am using ArcGIS Pro 2.6.1.


Hi @virtualcitymatt​,

 

Thanks for the reply. I tried your suggestion and removed the groups argument but the same error was returned.

 

groups_translationerrorI am using ArcGIS Pro 2.6.1.

OK that is super weird. Can you try saving the workspace, closing it and reopening it? I suspect somehow it's still running the old code. There is no good reason why FME should be complaining about 'groups' when it isn't even in the script.


Hi @virtualcitymatt​,

 

Thanks for the reply. I tried your suggestion and removed the groups argument but the same error was returned.

 

groups_translationerrorI am using ArcGIS Pro 2.6.1.

I tried your suggestion but the same error occurs. I'll try to run in an earlier version of FME and see if it will work, thanks.


Reply