I am trying to run the script generated by my graphical modeller through QGIS script. But I get the following error.

# Prepare the environment
import sys
from qgis.core import QgsApplication
#from PyQt4.QtGui import QApplication
qgs = QgsApplication([], False)
QgsApplication.setPrefixPath("/usr", True)

# Prepare processing framework 
from processing.core.Processing import processing


# Exit applications


python3 Script2.py
Traceback (most recent call last):
  File "Script2.py", line 15, in <module>
    processing.run("script:PointsToGrid", {'inputdatapoints':'file:///home/vinura/Documents/L900_10000.csv?type=csv&detectTypes=yes&xField=Longitude&yField=Latitude&crs=EPSG:4244&spatialIndex=no&subsetIndex=no&watchFile=no','Output':'/home/vinura/Documents/4.geojson'})
  File "/usr/share/qgis/python/plugins/processing/tools/general.py", line 106, in run
    return Processing.runAlgorithm(algOrName, parameters, onFinish, feedback, context)
  File "/usr/share/qgis/python/plugins/processing/core/Processing.py", line 125, in runAlgorithm
    raise QgsProcessingException(msg)
_core.QgsProcessingException: Error: Algorithm script:PointsToGrid not found

Simply, the script doesn't get the script:PointsToGrid I made using graphical modeller.

  • 1
    Your script seems to be correct. can you try running from qgis.core import QgsApplication for alg in QgsApplication.processingRegistry().algorithms(): print("{}:{} --> {}".format(alg.provider().name(), alg.name(), alg.displayName())) as suggested here. It should give you a list of available processing algorithms, check that your script is there.
    – Dror Bogin
    Sep 23, 2019 at 15:01

1 Answer 1


Good question. It is not obvious, but you need to copy your script algorithms to a specific folder to make your standalone script able to run them.

You can easily see where your script algorithms should be located by adding a couple of lines to your standalone script:

from processing.script import ScriptUtils
print("Folder for script algorithms:", ScriptUtils.scriptsFolders())

Once you copy your script algorithms there, run again your standalone script and it should be able to run them.

NOTE: If your script algorithm makes use of other algorithms not installed by default by Processing, you need to add them. See Using QGIS3 Processing algorithms from standalone PyQGIS scripts (outside of GUI) for an example to make Native C++ algorithms available for your standalone script.


Here is a sample script that you can take as a reference (adjust paths to your own QGIS location):

import sys

from qgis.core import QgsApplication
from qgis.analysis import QgsNativeAlgorithms

# See https://gis.stackexchange.com/a/155852/4972 for details about the prefix
QgsApplication.setPrefixPath('/docs/dev/qgis/QGIS/build_20190918/output', True)
qgs = QgsApplication([], False)

# Append the path where processing plugin can be found

import processing
from processing.core.Processing import Processing

from processing.script import ScriptUtils
print("[INFO] Folder for script algorithms:", ScriptUtils.scriptsFolders())
print("[INFO] Script algorithms available:", 
    [s.displayName() for s in QgsApplication.processingRegistry().providerById("script").algorithms()])

params = {'inputlayer':'/geodata/points.shp',
res = processing.run("script:my_model", params)

output_layer = res['OUTPUT']  # Access your output layer
  • This worked, but I had to import my CSV file first and convert it to a vector then feed it to the script. Anyway THANK YOU !!!!! Sep 24, 2019 at 6:40

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.