I have a geoprocessing script using ArcGIS API for Python that I've been using for several months. After upgrading to Pro 3.4, I can't do anything with the arcgis.gis module. I have Pro 3.3 installed on a different computer and the same script still works fine.
The script starts out as:
from arcgis.gis import GIS
gis = GIS("pro")
from arcgis.features import *
from arcgis.geometry import *
from arcgis.geometry.filters import within
import arcpy
def coordsCounty():
arcpy.AddMessage("Logged in as " + str(gis.properties.user.username))
I get an error on line 9, "AttributeError: module 'arcgis.gis' has no attribute 'properties'. I get errors on other arcgis.gis functions too, like a simple gis.content.get request that has never been problematic.
Package manager in Pro shows ArcGIS API for Python 2.4.0 is installed. I'm using a named user license through ArcGIS Online and it is the active portal in Pro.
Any ideas? Thanks.
There were lots of changes in the arcgis module, your scripts may have to be modified.
here is a deprecation list
arcgis-python-api/guide/02-api-overview/deprecation-notices.ipynb at master · Esri/arcgis-python-api
the changes in the most current version
arcgis-python-api/guide/02-api-overview/release_notes_240.ipynb at master · Esri/arcgis-python-api
and you can scroll back in time to previous versions from the links to the left of the page above
Thanks for sending the documentation, @DanPatterson. The Pro version that it still works on is 3.3, not 2.3 as I originally wrote in my post. Big difference! I don't see anything in the depreciation notices that would cause the issue. I'll put in a ticket with Esri support.
Pro 3.3 was using the api for pytho version 2.3 Pro 3.4 uses the api version 2.4 to clarify
For anyone else reading this, Esri logged a bug for this related to the geometry module. The workaround is to import the geometry modules individually instead of using a wildcard.
BUG-000173067 - Using a wildcard ('*') to import all from the arcgis.geometry module ("from arcgis.geometry import *") will output attribute error: "module 'arcgis.gis' has no attribute 'x" when running code with the ArcGIS API for Python version 2.4.