sb52191

Error 999999 while renaming raster.

Discussion created by sb52191 on Jul 15, 2013
Latest reply on Jul 15, 2013 by rzufelt
Hi,
I keep getting error 999999 while trying to rename a raster. The code is below. Any advice?

for raster in arcpy.ListRasters():
    #raster_name_check= raster[40]
    if len(raster)>=40:
        # get the raster name and file extension
        fileName,fileExtension = os.path.splitext(raster)

        #fileNameParts = fileName.split('_')
        compactFileName = fileName[7:12] + fileName[23:29]
        arcpy.CopyRaster_management(raster, compactFileName)
        compactFileName2= fileName[7:12] + fileName[23:29] + fileName[34:38]
        arcpy.Rename_management(compactFileName,compactFileName2)
        raster_list.append(compactFileName2)
        print raster_list
    if len(raster)<=40:
        print "Skip"

Outcomes