I'm using a Notebook in ArcGIS Pro to run the Enrich GP tool to add demographics in several countries. The script fails when attempting to change the data source of the environments. A copy of the python command when running the GP shows as:
with arcpy.EnvManager(baDataSource="Online;AL|census;"):
arcpy.analysis.Enrich("<Layer>", out_path, variables, buffer_type)
AL is the country code which changes with each iteration. I create a variable named "source" which looks the same as the GP output shown above. In the script the syntax looks like:
with arcpy.EnvManager(source):
arcpy.analysis.Enrich("<Layer>", out_path, variables, buffer_type)
But when I run it, I get this error:
EnvManager.__init__() takes 1 positional argument but 2 were given
It appears arcpy.EnvManager () does not accept variables. Can someone confirm this? Is there a way to programmatically change the enrichment source country?