I am using a QGIS plugin which provides a Processing algorithm but does not know how to handle QgsProcessing.TEMPORARY_OUTPUT as parameter value for its output. I.e. I have to provide it with an explicit file path.

I would like to use the same logic that QGIS normally uses when encountering QgsProcessing.TEMPORARY_OUTPUT, which is a new directory inside its current temporary processing directory.

How can I generate an output path matching QGIS' QgsProcessing.TEMPORARY_OUTPUT logic to manually provide to the misbehaving plugin?

PS: A fix for the plugin is in the works but waiting is not an option.

1 Answer 1


QgsProcessingDestinationParameter provides a generateTemporaryDestination() method.

As it is an abstract base class you need an instance of a child class, e. g.

  • QgsProcessingParameterFileDestination
  • QgsProcessingParameterFolderDestination
  • QgsProcessingParameterRasterDestination
  • QgsProcessingParameterVectorDestination

For example if you need a temporary output path suitable for a raster file:

>>> dest = QgsProcessingParameterRasterDestination(name="foo")
>>> dest.generateTemporaryDestination()

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.