ArcGIS Python API error- 'GIS' object has no attribute 'tools'

3414
4
03-27-2017 11:50 PM
Durga_D
New Contributor II

Getting hands on with latest ArcGIS Python API.Getting below error after running processing sample.

Using Geoprocessing tools | ArcGIS for Developers 

from arcgis.gis import GIS

gis = GIS()
map = gis.map()
map

diegogarcia = gis.tools.geocoder.find_best_match("Diego Garcia")
map.center = diegogarcia

AttributeError                            Traceback (most recent call last)<ipython-input-3-cb8f9185cd0a> in <module>()----> 1 diegogarcia = gis.tools.geocoder.find_best_match("Diego Garcia")      2 map.center = diegogarciaAttributeError: 'GIS' object has no attribute 'tools' 

I have completed all necessary configurations suggested at Install and set up | ArcGIS for Developers 

conda,Jupyter Notebook and upgraded to latest versions.

0 Kudos
4 Replies
NeilAyres
MVP Alum

Its exactly as the error says, there is no attribute or method with the GIS object for Tools.

arcgis.gis module — arcgis 1.0.1 documentation 

You should look at the geocoding module.

arcgis.geocoding module — arcgis 1.0.1 documentation 

Durga_D
New Contributor II

I have tried geocoding module and it is working fine.

Should I infer that the example provided by ESRI at Using Geoprocessing tools | ArcGIS for Developers  is wrong and get corrected in future ?

diegogarcia = gis.tools.geocoder.find_best_match("Diego Garcia")
0 Kudos
JoshuaBixby
MVP Esteemed Contributor

The code isn't wrong, per se, it just isn't accurate for the current version of the API.  The structure of the API has changed fairly significantly over the past 6 months or so.  Unfortunately, Esri has an issue with their URLs for the ArcGIS API for Python.  For example, the 2 URLs goto different pages with different examples:

https://developers.arcgis.com/python/sample-notebooks/Using-Geoprocessing-tools/ 

https://developers.arcgis.com/python/sample-notebooks/using-geoprocessing-tools/ 

Notice the capitalization differences.  The URL that is all lowercase has the most current/accurate content.

JoshuaBixby
MVP Esteemed Contributor

I just heard back from the ArcGIS API for Python team, the problems URLs have been updated to redirect to the current/accurate URLs.