AnsweredAssumed Answered

AttributeError: 'module' object has no attribute 'da'

Question asked by yaron148 on Jan 28, 2015
Latest reply on Jan 28, 2015 by yaron148

Hello

I try to edit attribute table for 20 shapefiles that spread in big a folder and are divided to a lot of sub folders. All shapefiles are called "migrashim" and the name of the filed that i want to change is "structuretype". I try this code:

when i run this code:

 

import arcpy,os,sys
from arcgisscripting import da


pattern = 'migrashim.shp'
folder = r"C:\Project\layers" ## root folder
field = 'YEUD' ## your field where calculation to be applied
files_process = []
for root,dirs,files in os.walk(r"C:\Project\layers"):
    for filenames in files:
        if filenames == pattern:
            files_process.append(os.path.join(root, filenames))


for i in files_process:
    curU = arcpy.UpdateCursor(i)
    for row in curU:
        row.setValue(field, 500)##Any expression you want
        curU.updateRow(row)
del curU

 

i get an error:

 

Traceback (most recent call last):
  File "C:\Users\yaron.KAYAMOT\Desktop\ar.py", line 1, in <module>
    import arcpy,os,sys
  File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\__init__.py", line 24, in <module>
    from arcpy.toolbox import *
  File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\toolbox.py", line 15, in <module>
    from .ddd import ASCII3DToFeatureClass as ASCII3DToFeatureClass_3d
  File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\ddd.py", line 23, in <module>
    from arcpy.arcobjects.arcobjectconversion import convertArcObjectToPythonObject
  File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\arcobjects\__init__.py", line 15, in <module>
    from _base import *
  File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\arcobjects\_base.py", line 16, in <module>
    from .arcobjectconversion import convertArcObjectToPythonObject
  File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\arcobjects\arcobjectconversion.py", line 2, in <module>
    import arcpy.mapping
  File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\mapping.py", line 15, in <module>
    from _mapping import MapDocument, Layer, TableView, constants
  File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\_mapping.py", line 15, in <module>
    from arcpy.arcobjects import mixins
  File "C:\Program Files (x86)\ArcGIS\Desktop10.3\ArcPy\arcpy\arcobjects\mixins.py", line 16, in <module>
    curU = arcpy.da.UpdateCursor(i,field)
AttributeError: 'module' object has no attribute 'da'

i need help !!

Outcomes