redsnake91

Help Python (Parameters)

Discussion created by redsnake91 on Apr 11, 2014
Latest reply on Apr 12, 2014 by eibenm
Hi, I have a little problem, and I hope you guys will be able to help me :]

My goal is make a parameters that will '' search '' in a field (name of a street) in a csv file.

Python doesn't seem to recognize the string parameter.

Here is my code:


    road_name = arcpy.GetParameterAsText(0)
    arcpy.AddMessage (road_name) just to see if it works (and it doesn't)
      
    f5_in = open (ROAD,'r') ROAD is my csv file
    f5_in.readline()


    for ligne in f5_in:
        lecture = extraction(ligne) split on my csv file and put it in 4 index
        if lecture[4].upper()== road_name.upper():
           arcpy.AddMessage("YOUR ROAD IS ON THE LIST")
           break
           
    if road_name.upper() != lecture[4].upper():
         arcpy.AddMessage("YOUR ROAD IS NOT ON THE LIST")

    f5_in.close()




Overall it worked fine when I used Raw_input, and now that I use GetParameterAsText nothing work.

How can I solve this problem ?

Thank you !

Outcomes