Skip to main content
2 of 4
added 1 character in body

Wrong or missing parameter QgsProcessingParameterFile QGIS 3.4 Python plugin

I'm making a script that can be called by the processing.execAlgorithmDialog function. For one of the parameters, I want to use the QgsProcessingParameterFile class for selecting a .csv file.

I tried the following:

class T4_Visualiseer_Networks_Resultaat(QgsProcessingAlgorithm):

    PrmOutputFile = 'Networks result'

    self.addParameter(
        QgsProcessingParameterFile(
            name=self.PrmOutputFile,
            description="Networks resultaat",
            extension="csv(*.csv)"
        )
    )

    def processAlgorithm(self, parameters, context, feedback):
        # Some code to do after clicking ok

When I select a .csv file in a folder and press OK to begin the script, I get the message Wrong or missing parameter value: Networks resultaat (see picture below).

enter image description here

I already tried the following:

  • Replace / by \
  • Add behavior=0 to make sure a file is selected (this was already the case because the default value for behavior is 0)
  • Rename the .csv file

None of the above actions fixed the problem of getting this message and I can't find any other solutions on the internet. Do you have any idea what the problem can be or how it can fix it?

Thanks in advance!