I am running a script in QGIS which loops around a set of rasters performing a number of different processes ultimately outputting a new raster and a vector per input. At the end of each loop i get the error message 'python.exe has stopped working' but my output is still created and saved in the destination folder.
The script I am using is as follows:
##Input_raster=multiple raster ##result_shp=folder import os layers = Input_raster.split(';') for raster in layers: #Names for output result_name = os.path.splitext(os.path.basename(raster))  + "_Extent.tif" shp_name = os.path.splitext(os.path.basename(raster))  + "_Outline.shp" #Take grid and create extent out1=processing.runalg('gdalogr:rastercalculator', raster,'1',None,'1',None,'1',None,'1',None,'1',None,'1','A>0',None,5,None,result_shp + "/" + result_name) #Ratser extent to polygon out2=processing.runalg('gdalogr:polygonize', out1['OUTPUT'],'DN',None) #Calculate area m^2 and add to new field 'Area_m2' out3=processing.runalg('qgis:fieldcalculator', out2['OUTPUT'],'Area_m2',0,10.0,3.0,True,'$area',None) #Select polygons >5m^2 and extract to new shp out4=processing.runalg('qgis:extractbyattribute', out3['OUTPUT_LAYER'],'Area_m2',3,'5',None) #Fill holes less than 200m^2 out5=processing.runalg('qgis:fillholes', out4['OUTPUT'],200.0,result_shp + "/" + shp_name)
Is there a reason this might be occurring for each loop?
Do i need to somehow 'close' the input or output at the end of each loop to avoid this happening?
I have now run the same process using QGIS Graphical Modeller and found the same error stopping the process at step 1 GDAL raster calculator. When I view the log the final message given is 'GDAL command output:'