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)
QgsApplication.initQgis()
# Prepare processing framework
sys.path.append('/usr/share/qgis/python/plugins/')
#sys.path.append('usr/lib/qgis/plugins')
from processing.core.Processing import processing
#processing.initialize()
processing.run('script:AppPointsToGrid',
{'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'})
# Exit applications
QgsApplication.exitQgis()
QApplication.exit()
Error
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.
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 '19 at 15:01