Skip to main content
10 events
when toggle format what by license comment
Dec 22, 2016 at 20:21 vote accept Laura
Dec 22, 2016 at 20:21 comment added Laura You are a lifesaver, Ben!! Thank-you. That did the trick!
Dec 22, 2016 at 20:16 history edited Ben S Nadler CC BY-SA 3.0
added code
Dec 22, 2016 at 20:12 comment added Ben S Nadler Your code, with some mods, ran for me. Please review the comments above. I think you have an old layer without the field in memory. Use arcpy.env.overwriteOutput = True to overwrite the layer each time
Dec 22, 2016 at 18:32 comment added Ben S Nadler update your question with the new code and error details. Usually a second pair of eyes can help a lot. Use arcpy.GetMessages() after the failure to get mode details on the errror.
Dec 22, 2016 at 18:28 comment added Laura My issue is different now. The field was indeed named GRIDCODE, but somehow, where the FieldCalculator wasn't working before, it just did, so now I have a field named 'gridvalue', but I'm getting the same error in the SelectLayerByAttribute line whether I try using the formatting you suggested or the actual field name and value, i.e., '"gridvalue" = 1'. I am sure it is something simple that I'm missing. I just can't see it.
Dec 22, 2016 at 18:21 comment added Ben S Nadler so did that resolve your issue?
Dec 22, 2016 at 18:11 comment added Laura Thanks to both of you for responding. When I check the field name and alias name using arcpy.Describe, both are 'GRIDVALUE'.
Dec 22, 2016 at 18:07 comment added maverickGIS As the answer above suggests, I would make sure you aren't using the field alias rather than field name, and that your capitalization matches... I make this mistake when I don't double check. Also good to know about the " " required on shape files, I didn't realize that having worked only with feature classes which don't require any quotes on the field name
Dec 22, 2016 at 17:36 history answered Ben S Nadler CC BY-SA 3.0