import arcpy
from arcpy import env
import os
mxd = arcpy.mapping.MapDocument("CURRENT")
df = arcpy.mapping.ListDataFrames(mxd, "Layers")[0]
lyr = arcpy.mapping.ListLayers(mxd, "RevisedGroundZones", df)[0]
lyr.definitionQuery = ' "Grounds_GSC_Zones" = \'2\''
So, similar to your code, could do it this way as well if you wanted to iterate through the list instead of just grabbing the first item (normally first of one):
for lyr in arcpy.mapping.ListLayers(mxd, "*"):
if lyr.name == "RevisedGroundZones":
lyr.definitionQuery = ' "Grounds_GSC_Zones" = \'2\''
The "List"Layers and "List"DataFrames create a list of matching objects, so, all Dataframes with name "Layers" would be appended to the df list, and all layers, within the specified dataframe, that match "RevisedGroundZones" would be appended to the lyr list. However, putting the [0] actually makes it grab the first item in the list. I am assuming here that you only have one dataframe named "Layers" and one layer within that named "RevisedGroundZones". That way, there would only be one item in each list, so putting the [0] on the end grabs it without having to iterate through a list of one.I have successfully ran this and it applies the definition query (of course, this is for text field, if your RevisedGroundZones attribute is a number field, the quotes need to dissapear from the definition query.So, if you only have one dataframe name "Layers" (or "layers" as list function here is not case sensitive), and within that only one layer named RevisedGroundZones, it should be applying the definition query. If you have more than one with this name, it would only apply to the first on in the list. Would then need to iterate through if you wanted it applied to all with that name.Of course, you can always throw a mxd.save() in there after the definition query, then open the mxd with arc map and see what the actual def query being applied is (and if there are any drawing errors related).Once you get the def query working, then let it move on to the clipping.R_