AnsweredAssumed Answered

using arcpy outside of arcgis

Question asked by merrittr on Oct 14, 2014
Latest reply on Oct 14, 2014 by oearley

I have a script like this:

 

 

import arcpy

 

 

featureClass = "C:\\geology\\allgeology\\zipfolder\\data.gdb\\Mineral_Occurrences"

 

 

rows = arcpy.SearchCursor(featureClass)

row = rows.next()

 

 

while row:

    print row.NAME

    row = rows.next()

 

I get

 

 

 

Traceback (most recent call last):

  File "C:\Student\lister.py", line 3, in <module>

    import arcpy

ImportError: No module named arcpy

 

 

 

then I tried:

 

import sys

sys.path.append("C:\\Program Files (x86)\\ArcGIS\\Desktop10.1\\arcpy")

import arcpy

 

 

featureClass = "C:\\geology\\allgeology\\zipfolder\\data.gdb\\Mineral_Occurrences"

 

 

rows = arcpy.SearchCursor(featureClass)

row = rows.next()

 

 

while row:

    print row.NAME

    row = rows.next()

 

 

and now I get

 

Traceback (most recent call last):

  File "C:\Student\lister.py", line 3, in <module>

    import arcpy

ImportError: No module named arcpy

>>> ================================ RESTART ================================

>>>

 

 

Traceback (most recent call last):

  File "C:\Student\lister.py", line 3, in <module>

    import arcpy

  File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\__init__.py", line 21, in <module>

    from arcpy.geoprocessing import gp

  File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\geoprocessing\__init__.py", line 14, in <module>

    from _base import *

  File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\geoprocessing\_base.py", line 14, in <module>

    import arcgisscripting

ImportError: No module named arcgisscripting

>>>

 

 

how do I run these scripts outside of arcgis?

Outcomes