Solved! Go to Solution.
The answers above don't take case into account, which is the variation that you mentioned.
if ras.endswith("_pa") or ras.endswith("_PA"):
for ras in arcpy.ListRasters: if not ras.lower().endswith("_pa"): continue #now you are working with the correct raster, and you can do what you need arcpy.management.Rename(ras,"PA_" + ras[:-3])
If you're importing os anyway, you can also use os.rename() rather than copying the raster. Rest is what James & Adam wrote about getting the name correctly.
arcpy.Rename_management(ras, newrastername)
Though it may be tricky to get all of the auxiliary files if you are using os.rename(), right? I assume that it's not just "raster.tif", but also "raster.tif.xml" and "raster.tfw", or .jpg, etc. If you use the arcpy function, it'll rename all of the associated files at once. Also, if the rasters are stored in a fGDB or something, I don't there's anyway you'd be able to access them with the os module. It all depends on how/where they are stored.
I've never used it before, but the Rename function that I linked to above looks super useful.
but it failed with a "table already exists" error.
if arcpy.Exists(newrastername): arcpy.management.Delete(newrastername)
Sounds like the newrastername already exists in the GDB?