The looping process I'm working on outputs two files (table and image), and I'm trying to name them with matching numbers. I'm using
arcpy.CreateUniqueName to generate new filenames into a GDB each time the loop runs. The problem is, while the first
CreateUniqueName usage produces new filenames in the expected sequence each time I run it, the second usage just keeps overwriting the original file, with filenames never progressing past the starting filename.
Here's the code, followed by the resulting print statements from 3 sequential runs:
out_prof = r'F:\Joe_School\Thesis\scripts\Jerry\scratch.gdb\testprof' patch = r'F:\Joe_School\Thesis\data\grid_extract\mask400_1' import arcpy, os from arcpy import env import arcpy.ddd as DDD import arcpy.management as DM env.overwriteOutput = True env.outputCoordinateSystem = arcpy.Describe(patch).spatialReference env.workspace = os.path.dirname(out_prof) arcpy.CheckOutExtension('3D') tablename = arcpy.CreateUniqueName('prof_table') graphname = arcpy.CreateUniqueName('prof_graph') prof = DDD.StackProfile(out_prof, patch, tablename, graphname) DM.SaveGraph(graphname, graphname + '.gif') arcpy.CheckInExtension('3D') print "Created files:" + "\n " + tablename + "\n " + graphname >>> Created files: F:\Joe_School\Thesis\scripts\Jerry\scratch.gdb\prof_table F:\Joe_School\Thesis\scripts\Jerry\scratch.gdb\prof_graph >>> Created files: F:\Joe_School\Thesis\scripts\Jerry\scratch.gdb\prof_table0 F:\Joe_School\Thesis\scripts\Jerry\scratch.gdb\prof_graph >>> Created files: F:\Joe_School\Thesis\scripts\Jerry\scratch.gdb\prof_table1 F:\Joe_School\Thesis\scripts\Jerry\scratch.gdb\prof_graph
Why are these seemingly identical statements behaving differently?