I've been trying to use subprocess for a while now, but can't get it to work when calling QGIS modules. Here's my script:
import subprocess
call("processing.runalg('gdalogr:merge',
[rasterin1,rasterin2],'false','false',5,rasterout)")
No matter the input rasters I use (or how I write their paths: I assume they should contain / , not \ to separate folders), I always get this error :
Traceback (most recent call last):
File "<input>", line 1, in <module>
File "C:\OSGEO4~1\apps\Python27\lib\subprocess.py", line 711, in __init__
errread, errwrite)
File "C:\OSGEO4~1\apps\Python27\lib\subprocess.py", line 948, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
I used gdalogr here (and it doesn't work), but could have used saga:module or grass:module.
The script works perfectly in the console (i.e. when not wrapped by subprocess.call).
I also note people use subprocess successfully to run gdal (Use subprocess.call with gdalwrap), so why subprocessing the processing module would not work?
Any clues?