I am trying to use QgsRasterCalculator to do some calculations. However, my script does not output anything. It also doesn't show any error codes, it just executes without writing the desired output raster.
I have tried printing all the inputs to the calculator, and they seem to be the correct values. I've also included print statements in various parts of the script, including the end, to see if it fully runs, and it does.
lyr = r'C:\my_path\input_raster.tif'
output = r'C:\my_path\output_raster.tif'
lyr = QgsRasterLayer(lyr)
exp = "%s * 2" % (lyr)
ras = QgsRasterCalculatorEntry()
ras.ref = 'test'
ras.raster = lyr
entries = [ras]
calc = QgsRasterCalculator(exp, output, 'GTiff', lyr.extent(), lyr.width(), lyr.height(), entries)
calc.processCalculation()