Select to view content in your preferred language

arcgis.gis module errors in Pro 3.4

233
4
12-11-2024 12:11 PM
jmaxwell_braun
Regular Contributor

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.

0 Kudos
4 Replies
DanPatterson
MVP Esteemed Contributor

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


... sort of retired...
jmaxwell_braun
Regular Contributor

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.

0 Kudos
DanPatterson
MVP Esteemed Contributor

Pro 3.3 was using the api for pytho version 2.3  Pro 3.4 uses the api version 2.4 to clarify


... sort of retired...
0 Kudos
jmaxwell_braun
Regular Contributor

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.

0 Kudos