I want to use QGIS and processing to run some tasks that would be redundant to do by hand. When I try to run a script as a stand alone I get the error
AttributeError: 'module' object has no attribute 'runalg'
When I use runandload in place of runalg, I can run the script, but only from within QGIS software. Do you know what I need to do to run the scripts as a stand alone? Below is my code, I'm using QGIS 2.8.6-Wien. I am new to Python in QGIS and if there's a better/more powerful library, let me know.
import processing
# Set variables
polygon_path = "/home/pathtopolygon.shp"
line_path = "/home/pathtoline.shp"
explode_path = "/home/explode.shp"
result_path = "/home/result.shp"
# tools
general.runalg("qgis:polygonstolines",polygon_path,line_path)
general.runalg('qgis:explodelines',line_path,explode_path)