I am using QGIS 3.4 but it does not have the option of saving a model to a Python script. So I installed QGIS 3.8, which has that option, loaded my model and saved it as a Python script. I loaded the script into the Python editor, clicked "run" and expected the script to work in Version 3.8, but it didn't. The Python console just gives back
exec(open('P:/.../QGIS_Import.py'.encode('utf-8')).read())
With loading it as a script it worked in QGIS 3.8: The model and the python script do not generate the same results, however, that is not the real problem. When I run the python script in QGIS 3.4 it gives this error:
Traceback (most recent call last):
File "C:\Users\heubacha\AppData\Roaming\QGIS\QGIS3\profiles\default\processing\scripts\__QGIS_3.8_Import_Original.py", line 73, in processAlgorithm
'OUTPUT': QgsProcessing.TEMPORARY_OUTPUT
AttributeError: type object 'QgsProcessing' has no attribute 'TEMPORARY_OUTPUT'
The code might not be downwards compatible...what is the correct coding in QGIS 3.4? This is the code snippet where the error occurs:
alg_params = {
'DISCARD_NONMATCHING': True,
'FIELD': 'STP',
'FIELDS_TO_COPY': None,
'FIELD_2': 'OZ2',
'INPUT': outputs['FbRefactorFields']['OUTPUT'],
'INPUT_2': parameters['formstp'],
'METHOD': 0,
'PREFIX': '',
'OUTPUT': QgsProcessing.TEMPORARY_OUTPUT
}
outputs['FbfsJoinAttributesByFieldValue'] = processing.run('native:joinattributestable', alg_params, context=context, feedback=feedback, is_child_algorithm=True)
feedback.setCurrentStep(50)
if feedback.isCanceled():
return {}