In QGIS 3.4.7 I have a script that I use in the toolbox and one of the steps is to store the name of the input tiff in a variable. I accomplish this perfectly with this part of the code:
from qgis.core import QgsProcessing
from qgis.core import QgsProcessingAlgorithm
from qgis.core import QgsProcessingMultiStepFeedback
from qgis.core import QgsProcessingParameterRasterLayer
class tiffname(QgsProcessingAlgorithm):
def initAlgorithm(self, config=None):
self.addParameter(QgsProcessingParameterRasterLayer('tiff', 'TIFF', defaultValue=None))
def processAlgorithm(self, parameters, context, model_feedback):
feedback = QgsProcessingMultiStepFeedback(25, model_feedback)
NAMETIFF = parameters['tiff'].name()
feedback.pushInfo(NAMETIFF)
return {}
def name(self):
return 'tiffname'
def displayName(self):
return 'tiffname'
def tr(self, string):
return QCoreApplication.translate('Processing2', string)
def createInstance(self):
return tiffname()
However in QGIS 3.14 I get this error:
NAMETIFF = parameters['tiff'].name()
AttributeError: 'str' object has no attribute 'name'
How to call name() in this version?