1

my searchCursor look like this.

arcpy.env.workspace = "C:\\Users\\Documents\\Scoring\\Ecodis_clip_split" #set workspace to folder with values

eco = arcpy.SearchCursor ("NAME.shp", "", "", "area_ha", "") 
#search for the value in attributetable

print(eco)

It is supposed to give a numeric value (area in ha) but instead it bounces back with this:

geoprocessing cursor object object at 0x02934DE0

I am working in PyScripter and I am wondering if that is my value (which should be numeric, precisely 141216) just expressed differently or something that went totally wrong.

5

Yes, eco is an object. You need to iterate to see its element.

arcpy.env.workspace = "C:\\Users\\Documents\\Scoring\\Ecodis_clip_split" #set workspace     to folder with values

eco = arcpy.SearchCursor ("NAME.shp", "", "", "area_ha", "") 
#search for the value in attributetable

for row in eco:
   print(row.getValue("area_ha"))
  • Ah, alright. But when I want to write the value of that object (eco) into a list and populate with an UpdateCursor another table do i have to change that objekt to any or should it work like this? – Stophface Jun 27 '14 at 16:52
  • If it's just one value, then area = row.getValue("area_ha") assigns 141216 to the variable, and it can be used in an UpdateCursor statement later on. But if it's multiple values, the question then becomes how do you ensure that the right values are getting into the right rows of your second table -- a join would be better in this latter case. – Erica Jun 27 '14 at 17:03
  • its just one value :) Now I need to figure out how to add the value to the other table! That indexstuff is yet not clear for me :) – Stophface Jun 27 '14 at 17:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.