Select to view content in your preferred language

can not use raw_input in tool or arcgis10 desktop python window

897
1
10-26-2010 09:24 AM
xiaowenyang
Deactivated User
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
0 Kudos
1 Reply
MikeSmith7
Emerging Contributor
Have you solved this problem?  I am currently have this challenge.

Thanks
0 Kudos