[Qgis-developer] Processing scripts in stand-alone Python scripts

Anita Graser anitagraser at gmx.at
Thu Nov 26 02:06:43 PST 2015


Hi,

I'm trying to run Processing scripts in a stand-alone Python script. The
examples available online for calling default, e.g. QGIS algorithms, work
fine but when I try to access a script instead, it cannot be found, i.e.
getAlgorithm() returns None.

Am I missing something or is this a bug?

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

# Prepare processing framework
sys.path.append('/home/agraser/.qgis2/python/plugins')
from processing.core.Processing import Processing
Processing.initialize()

print Processing.getAlgorithm("qgis:creategrid") # works
print Processing.getAlgorithm("script:helloworld") # doesn't work

# Exit applications
QgsApplication.exitQgis()
QApplication.exit()


Thanks and best wishes,
Anita
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20151126/f23cf0fc/attachment-0001.html>


More information about the Qgis-developer mailing list