I am trying to use the GIS Object in python to query against my AGOL.
Right now the only way I can get this to work is if I use .py 3.x
Is there a way to use this object from .py 2.7 with "import arcpy"?
from arcgis.gis import GIS
import arcgis
agol_username = 'xxxx'
agol_password = 'xxxx'
output_csv = r'C:\Users\ccc\Desktop\GIS_projects\AGOL_Python\UsersAboutToExpire.csv'
search_user = '*'
gis = GIS('https://xxx.maps.arcgis.com', agol_username, agol_password)
user_list = gis.users.search(query=search_user, max_users=2000)
roles = gis.users.roles.all()
rol_ids = {role.role_id: role.name for role in roles}
output = []
Solved! Go to Solution.
Hello @kapalczynski,
Firstly , I think you are mixing arcpy vs arcgis library. Both are completely different libraries with specific aim. arcpy focused on bringing desktop arcobjects tools ready to your python scripts and arcgis is the standard library to use on web-based GIS (management tasks, spatial analysis, etc.).
GIS Object (or class) is available only through arcgis library. In some Python environments (like in ArcGIS PRO's or Server's default env) you may use either of them depending on your workflow.
Secondly, Python 2.7 was officially retired in 2020, so stick to Py3.
Cheers,
Hello @kapalczynski,
Firstly , I think you are mixing arcpy vs arcgis library. Both are completely different libraries with specific aim. arcpy focused on bringing desktop arcobjects tools ready to your python scripts and arcgis is the standard library to use on web-based GIS (management tasks, spatial analysis, etc.).
GIS Object (or class) is available only through arcgis library. In some Python environments (like in ArcGIS PRO's or Server's default env) you may use either of them depending on your workflow.
Secondly, Python 2.7 was officially retired in 2020, so stick to Py3.
Cheers,
OK thanks... Yea 3.x is the only one I can run it on.... Sadly our server is not there yet... Thanks