I am trying to split a file name and shorten it. They are .tif files. The code I am using is:
from arcpy import env
env.workspace = "C:\GIS_Projects\VA_1Meter_DEMs\Working_Shapefiles"
in_data = arcpy.ListRasters()
for raster in in_data:
part = raster.split("_")
out_data = part + "_" + part + "_" + part + ".tif"
I am receiving this error:
Traceback (most recent call last):
File "C:/GIS_Projects/Pyth_Code/RenameDem.py", line 12, in <module>
File "C:\Program Files (x86)\ArcGIS\Desktop10.7\ArcPy\arcpy\management.py", line 4524, in Rename
RuntimeError: Object: Error in executing tool
The code does print out the raster list in the directory, and also prints out the first raster in the list split, so I know that part is working. I am stumped where it is supposed to execute the name change though.