I'm working with a QGIS plugin widget and I have a box which creates a temporary table as an output. I've created the box using the QgsProcessingParameterFeatureSink class. Here is how I created my box in the initAlgorithm and created a feature sink in the processAlgorithm:
class EstimateEcosystemServiceValuesForStudyRegion(QgsProcessingAlgorithm): OUTPUT_ESV_TABLE = 'OUTPUT_ESV_TABLE' def initAlgorithm(self, config): self.addParameter( QgsProcessingParameterFeatureSink( self.OUTPUT_ESV_TABLE, self.tr("Output ESV Table"))) def processAlgorithm(self, parameters, context, feedback): #I created the output_esv_table_fields in another part of the code (sink, dest_id) = self.parameterAsSink(parameters, self.OUTPUT_ESV_TABLE, context, output_esv_table_fields)
Line 284 in my code is this line from the above code example:
(sink, dest_id) = self.parameterAsSink(parameters, self.OUTPUT_ESV_TABLE, context, output_esv_table_fields)
This unknown error doesn't tell me much about how to fix it. Also, it is bad from a User Experience perspective to have a widget box which you must leave empty. So I tried removing the box completely.
Now when I run the widget (with this box removed), QGIS just crashes. It seems I must declare an output parameter for this feature sink object, but I am confused because the user doesn't input anything in the widget box.
Can I remove the feature sink box, but still produce this table as an output?