I'm getting the following error with my code which is generated in excel using a VB script. I am really confused as to what's triggering it:Parsing error <type 'exceptions.SyntaxError'>: invalid token (line 16)
import arcpy
mxd = arcpy.mapping.MapDocument('CURRENT')
lyr = arcpy.mapping.Layer("EPREC_SEQ")
lyr_1 = arcpy.mapping.Layer("Polls")
df = arcpy.mapping.ListDataFrames(mxd, "2012-06-05")[0]
lyr.definitionQuery = '"CONSNUM" = 135080 or "CONSNUM" = 135220'
lyr_1.definitionQuery = '"CONSNUM_1" = 135080 or "CONSNUM_1" = 135220'
df.extent = lyr.getExtent(True)
var_text = 0176
element_name = "map_ID"
for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", element_name):
if elm.name == element_name:
elm.text = (var_text)
arcpy.RefreshActiveView()
arcpy.mapping.PrintMap (mxd)
var_text = 0184
element_name = "map_ID"
for elm in arcpy.mapping.ListLayoutElements(mxd, "TEXT_ELEMENT", element_name):
if elm.name == element_name:
elm.text = (var_text)
arcpy.RefreshActiveView()
arcpy.mapping.PrintMap (mxd)
The error is strange because it's identical code to line 9 which goes through fine. I put in one line at a time and for some reason when I set my var_text to anything above 0177 and anything below 200 I get the error, otherwise the code works fine. Any thoughts?