I have a QGIS Project with many raster layers. I need to change/repair all paths since I moved the original data to Another disk.
layer = iface.activeLayer()
old_path = r'D:/Somefolder_QGIS_200317'
new_path = r'C:\GIS\Newfolder'
layer.setDataSource(layer.source().replace(old_path, new_path))
But im getting error:
TypeError: QgsRasterLayer.setDataSource(): not enough arguments
What am I missing?