gis - ARCGIS python, indent error? -


i'm running code indent error. seems problem? ran many times. when run code through idle, box says:

syntax error: there's , error in program: expected indented block

code:

import arcpy arcpy import env import math folder_path = r"j:\sanda" # define workspace folder path  env.workspace = folder_path  # allow overwriting output files arcpy.env.overwriteoutput = true  #parameters text input_lake = arcpy.getparameterastext(0) input_cities = arcpy.getparameterastext(1) output_lake = arcpy.getparameterastext(2)  city= "city_name" cntry= "city_cntry" admin= "admin_name" pop_city= "population" dist_km= "distance" x_coord= "x_cord" y_coord= "y_cord"   #copy lakes shapefile arcpy.copyfeatures_management(input_lake, output_lake)  #add fields (city_name, x coord, y coord, etc) arcpy.addfield_management(output_lake, city, "text") arcpy.addfield_management(output_lake, cntry , "text") arcpy.addfield_management(output_lake, admin, "text") arcpy.addfield_management(output_lake, pop_city, "double") arcpy.addfield_management(output_lake, dist_km, "double") arcpy.addfield_management(output_lake, x_coord, "double") arcpy.addfield_management(output_lake, y_coord, "double")   #create empty lists citylist_city_name = [] citylist_x = [] citylist_y = [] city_name = [] city_cntry = [] admin_name = [] dist_km= [] pop= []  #populate these lists values city_cursor= arcpy.searchcursor(input_cities) city in city_cursor:     geom = city.shape     citylist_x.append(geom.firstpoint.x)     citylist_y.append(geom.firstpoint.y)     citylist_city_name.append(city.city_name)     city_cntry.append(city.cntry_name)     admin_name.append(city.admin_name)     pop.append(city.population)  #get number of cities city_length = len(citylist_x)  #read lake geometries lake_cursor = arcpy.updatecursor(output_lake)  #loop through each lake lake in lake_cursor:     lake_geom = lake.shape  #initiate lake distances city_dist_list = []  #loop through each city cityid in range(0, city_length - 1):  #get x , y current city cityx=citylist_x[cityid] cityy=citylist_y[cityid]  #get x , y current lake lakex = lake_geom.centroid.x lakey = lake_geom.centroid.y         #calculate distance dist = math.sqrt((cityx-lakex)**2 +(cityy-lakey)**2 city_dist_list.append(dist)      closest = min(city_dist_list)     closestid = city_dist_list.index(closest)      #set values new lake feature     lake.city_name = citylist_city_name[closestid]     lake.x_cord = citylist_x [closestid]     lake.y_cord = citylist_y [closestid]     lake.distance = closest*(0.001)     lake.admin_name = admin_name [closestid]     lake.population = pop [closestid]     lake.city_cntry = city_cntry [closestid]     lake_cursor.updaterow(lake)  #kill cursors del city_cursor, lake_cursor, lake, city, cityid, geom, lake_geom  print "done" 

the for-loop in code not indented properly, must :

for cityid in range(0, city_length - 1):     #get x , y current city     cityx=citylist_x[cityid]     cityy=citylist_y[cityid]      #get x , y current lake     lakex = lake_geom.centroid.x     lakey = lake_geom.centroid.y         #calculate distance     dist = math.sqrt((cityx-lakex)**2 +(cityy-lakey)**2)     city_dist_list.append(dist)      closest = min(city_dist_list)     closestid = city_dist_list.index(closest)      #set values new lake feature     lake.city_name = citylist_city_name[closestid]     lake.x_cord = citylist_x [closestid]     lake.y_cord = citylist_y [closestid]     lake.distance = closest*(0.001)     lake.admin_name = admin_name [closestid]     lake.population = pop [closestid]     lake.city_cntry = city_cntry [closestid]     lake_cursor.updaterow(lake) 

secondly missing closing ) on line:

dist = math.sqrt((cityx-lakex)**2 +(cityy-lakey)**2) 

Comments