finalElevRow = arcpy.SearchCursor("selectedFeatures_lyr", whereClause) rowcount = 0 for row in finalElevRow: rowcount += 1 print "I found the following number of local elevation features with that value: " print rowcount del finalElevRow, row finalElevRow = arcpy.SearchCursor("selectedFeatures_lyr", whereClause) if rowcount == 1: for row in finalElevRow: currentElevId = glob.ORIG_FID print "This is the ID of the new summit feature: " print currentElevId else: currentElevId = -9999 print "This is the ID of the new summit feature: " print currentElevId del finalElevRow, row
finalElevRow = arcpy.SearchCursor("selectedFeatures_lyr", whereClause) rowcount = 0 for thing in finalElevRow: rowcount += 1 print "I found the following number of local elevation features with that value: " print rowcount del finalElevRow finalElevRow = arcpy.SearchCursor("selectedFeatures_lyr", whereClause) if rowcount == 1: for glob in finalElevRow: currentElevId = glob.ORIG_FID print "This is the ID of the new summit feature: " print currentElevId else: currentElevId = -9999 print "This is the ID of the new summit feature: " print currentElevId del finalElevRow
## select from previously selected records the record(s) with the max elevation value whereClause = "RASTERVALU = "+(str(localMax)).strip() ## search cursor result for counting finalElevRow = arcpy.SearchCursor("selectedFeatures_lyr", whereClause) ## check the number of records we just selected and assign a null value if we selected more than 1 record count = 0 rowcount = 0 for row in finalElevRow: rowcount += 1 print "I found the following number of local elevation features with that value: " print rowcount finalElevRow.reset() if rowcount == 1: for row in finalElevRow: currentElevId = row.ORIG_FID print "This is the ID of the new summit feature: " print currentElevId else: currentElevId = -9999 print "This is the ID of the new summit feature: " print currentElevId
It's hard to tell what is actually happening, as pythonwin getting in the way...Try saving your file to the location of python.exe (typically C:\Python26\ArcGIS10.0\), then use command prompt to navigate there and run it with:python summits.pyThis will (probably) still crash, but it ought to at least give you a line number to work from. Otherwise it will crash the whole command window, which leaves us where we are at the moment, but with a few possibilities eliminated...Let me know how you get on!
python summits.py
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.