Why is "from argis.gis import GIS" not possible

2196
3
Jump to solution
09-28-2017 07:46 AM
BernhardEhrminger
New Contributor III

From Eclipse I run C:\Program Files\ArcGIS\Pro\bin\Python\Scripts\propy.bat provided by the Installation of ArcGIS Pro. 

the following python script:

import arcpy
import sys


print(sys.executable)
print(sys.version)

for p in sys.path:
    print(p)

for k, v in arcpy.GetInstallInfo().items():
    print (k, v)

from argis.gis import GIS  # @UnresolvedImport
g = GIS()
g.map()

generates the following Output:

C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe

3.5.3 |Continuum Analytics, Inc.| (default, Feb 22 2017, 21:28:42) [MSC v.1900 64 bit (AMD64)]

Q:\_EclipseWorkspaces\b.e\Geoprocessing_py3\src\test

Q:\_EclipseWorkspaces\b.e\Geoprocessing_py3\src

C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\DLLs

C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib

C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3

C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages

C:\Program Files\ArcGIS\Pro\bin

C:\Program Files\ArcGIS\Pro\Resources\ArcPy

C:\Program Files\ArcGIS\Pro\Resources\ArcToolbox\Scripts

C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\future-0.16.0-py3.5.egg

C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\pytz-2017.2-py3.5.egg

C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\setuptools-27.2.0-py3.5.egg

C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\sympy-1.0-py3.5.egg

C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python35.zip

C:\Program Files\ArcGIS\Pro\bin

C:\Program Files\ArcGIS\Pro\Resources\ArcPy

C:\Program Files\ArcGIS\Pro\Resources\ArcToolbox\Scripts

Installer xxxxxx.xxxxx

InstallType N/A

BuildNumber 8933

InstallDate 18.09.2017

SourceDir Y:\ESRI\ArcGIS_10.5.1\ArcGIS-Pro_2.0\ArcGISPro\

Version 2.0

SPNumber N/A

InstallDir c:\program files\arcgis\pro\

InstallTime 16:27:40

SPBuild N/A

ProductName ArcGISPro

Traceback (most recent call last):

File "Q:\_EclipseWorkspaces\b.e\Geoprocessing_py3\src\test\test.py", line 19, in <module>

from argis.gis import GIS # @UnresolvedImport

ImportError: No module named 'argis'

I would like to know if this behaviour is by design or do expecting something impossible?

How do I proceed to use the ArcGIS Python API in "classic"-Geoprocessing?

0 Kudos
1 Solution

Accepted Solutions
Greg_Mattis
Occasional Contributor II

You have a typo: you have "from argis.gis import gis" according to the API reference, it is "from arcgis.gis import gis"

Greg Mattis, GISP
GIS Analyst
City of Visalia

View solution in original post

3 Replies
Greg_Mattis
Occasional Contributor II

You have a typo: you have "from argis.gis import gis" according to the API reference, it is "from arcgis.gis import gis"

Greg Mattis, GISP
GIS Analyst
City of Visalia
DanPatterson_Retired
MVP Esteemed Contributor

besides the misspell you can simplify your import line and re-assignment to...

from arcgis.gis import GIS as g

dir(g)
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__',
'__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__le__', '__lt__',
'__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__',
'__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__',
'_datastores', '_get_properties', '_repr_html_', '_server_list', 'content',
'groups', 'map', 'properties', 'update_properties', 'users']
SevincTaghiyeva
New Contributor

When I write this code, in the jupyter notebook gives an error in the notebook. what can I do?

Capture.PNG

0 Kudos