xiaowen

can not use raw_input in tool or arcgis10 desktop python window

Discussion created by xiaowen on Oct 26, 2010
Latest reply on Jul 13, 2011 by smithmc
I need run a script which basically zooms to every polygon by loop in the picked feature layer and ask the user to input a value and write the value back to the feature class. However, I can not get the raw_input window work, can anyone help me? Below is the code. Thank you very much for your help in advance.

import arcpy, sys, os
from arcpy import env

try:
    #get the current doc
    mapDoc = arcpy.mapping.MapDocument("CURRENT")
    #get the data frame
    df = arcpy.mapping.ListDataFrames(mapDoc)[0]
    lyr = arcpy.mapping.ListLayers(mapDoc, "BG2008Permeability", df)[0]
    thePath = lyr.dataSource
    print thePath
    cur = arcpy.UpdateCursor(thePath)
    if cur:
        print "get the cursor"
                for row in cur:
            newExtent = row.Shape.extent   # or geom.extent  
            df.extent = newExtent
            print "get the extent"
            thePattern = raw_input("\nwhich street pattern?\n")
            #strPattern = tkMessageBox.askquestion("which street pattern?" message = "0")
            #print strPattern
            row.StrPattern = thePattern
            cur.updateRow(row)
        del cur, row
except:
    if not arcpy.GetMessages() == "":
        arcpy.AddMessage(arcpy.GetMessages(2))
finally
    if cur:
        del cur
    if row:
        del row

Outcomes