Update Cursor  "Instance has no attribute" error

681
0
04-02-2013 08:22 AM
KevinYanuk
Occasional Contributor
I am looking to use an Update Cursor over a feature layer in a map document to, well, update a handful of attributes.  I seem to be getting an error that tells me the instance of my object does not have the attribute of the cursor's name...

Here is the problem code:

class Intersections():     def __init__(self):         self.path = arcpy.GetParameterAsText(1)          def updateAttributes(self):         self.intersections = arcpy.UpdateCursor(self.path)         self.centerlines = Centerlines()          arcpy.AddMessage("Updating node attributes...")         try:             for self.intersection in self.intersections:  #THIS IS WHERE IT FAILS



The error reads:  Intersections instance has no attribute 'intersection'


Oddly enough, in the same script, I have this code that does work properly:

def __init__(self):         self.path = arcpy.GetParameterAsText(2)      def copyAttributes(self):         self.addressRanges = arcpy.InsertCursor(self.path)         self.centerline = Centerlines()         self.centerlines = arcpy.SearchCursor(self.centerline.path)         arcpy.AddMessage("Copying new address ranges...")         try:             for self.centerline in self.centerlines:



Thanks

EDIT:  I was able to pinpoint the error, which was happening lower in the code.  I was trying to delete the cursors, which did not exist at that point.
Tags (2)
0 Kudos
0 Replies