I have a feature class that has data for the whole month of January with 'date' as one of the attribute categories (labeled ARGH here). I want to grab the information for each day in January and stick it in it's own feature class, so I have 31 separate files. So, as you'll see in the code below, I perform a query for each day, make a feature layer for that day's info and save the layer file to my gdb.
I don't get any error messages when I run it. HOWEVER, I can't find the saved layer files anywhere. I've looked all over. I can't figure out where I've gone wrong.
import arcpy, os arcpy.env.workspace = "L:\\gathr\\indonesia\\Sara\\SAISData\\AAAS\\SAIS2.gdb" arcpy.env.overwriteOutput = True Source_File = "AIS_Jan2016_CorrectTIme" field = "ARGH" Day_List = [row for row in arcpy.da.SearchCursor(Source_File,"ARGH")] Day_List1 = [x.encode('UTF8') for x in Day_List] UniqueDay = set(Day_List1) UniqueDay_List = list(UniqueDay) print UniqueDay_List arcpy.env.workspace = "L:\\gathr\\indonesia\\Sara\\SAISData\\AAAS\\SAIS2.gdb" outputpath = "L:\\gathr\\indonesia\\Sara\\SAISData\\AAAS\\SAIS2.gdb" for day_query in UniqueDay_List: out_layer = str(day_query)+ "lyr" out_layer_name= "s" + out_layer #out_layer_fc= "fc" + out_layer #MakeFeatureLayer variables in_features = "AIS_Jan2016_CorrectTIme" where_clause = ['ARGH = ' + "'" + day_query + "'"] #so as an sql-type query this would be ARGH = 'day_query' or something similar print where_clause workspace = "L:\\gathr\\indonesia\\Sara\\SAISData\\AAAS\\SAIS2.gdb" try: #Execute MakeFeatureLayer print in_features print out_layer print where_clause print workspace arcpy.MakeFeatureLayer_management(in_features, out_layer, where_clause, workspace) #Execute SaveToLayerFile arcpy.SaveToLayerFile_management(in_layer, out_layer_name) except: print arcpy.GetMessages()