I want to mosaic 2 rasters "rasa" and "rasb" using gdal_merge.py . While running the code, it produces an error " No input files selected". Can somebody help me to find the error in the code?
import subprocess
filea = 'C:/Users/claudio/workspace/test/test1/rasa.tif'
fileb = 'C:/Users/claudio/workspace/test/test1/rasb.tif'
output = 'C:/Users/claudio/workspace/test/test1/output.tif'
subprocess.call(['gdal_merge','-o',output,filea,fileb],shell=True)
Best Answer
The problem is you are passing a list to subprocess then specifying
shell=True
(which expects a string as input) so it is only taking the first item in the list, which isgdal_merge
, and running this. Just runninggdal_merge.py
gives the same error.The same code but without
shell=True
should work: