A previous question has established how to invoke QGIS's clip algorithm at the python console. I have done so and demonstrated that the method works satisfactorily on my data.
I would instead like to use this within a standalone script. To do so I've followed this to create the script below.
When I do so I get the following error message:
Unable to execute algorithm
Wrong parameter value: ./path/to/highways.shp
Can anyone outline what is going on here?
import sys
import qgis.core
import qgis.core as qgc
import PyQt4.QtGui
# Initialise the application
app = PyQt4.QtGui.QApplication([])
qgc.QgsApplication.setPrefixPath('/usr/bin/qgis')
qgc.QgsApplication.initQgis()
# Prepare processing framework
sys.path.append('/usr/share/qgis/python/plugins')
from processing.core.Processing import Processing
Processing.initialize()
import processing.tools
vlayer = qgc.QgsVectorLayer("./path/to/highways.shp", "highways", "ogr")
clayer = qgc.QgsVectorLayer("./path/to/boundaries.shp", "boundaries", "ogr")
processing.tools.general.runalg("qgis:clip", vlayer, clayer, "clip_from_script.shp")
qgc.QgsApplication.exitQgis()
PyQt4.QtGui.QApplication.exit()