<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#006600">
    Finally, I realized that it is a bug already submitted to the
    bugtracker <a class="moz-txt-link-freetext" href="https://issues.qgis.org/issues/12502">https://issues.qgis.org/issues/12502</a>.<br>
    In my experience, it is strongly correlated to some function in the
    processing plugin under both win7 and win10 and qgis 2.14 and 2.18
    (not under linux).<br>
    At the moment, I cannot say exactly where the problem is but I found
    that calling the runGdal function directly is a simple workaround.<br>
    Here a simple script as example, waiting for a final resolution of
    the issue:<br>
    <br>
    from processing.algs.gdal.GdalUtils import GdalUtils<br>
    import os<br>
    <br>
    class MYProgress():<br>
        # Not necessary if you have the processing progress available in
    your script<br>
        def setInfo(self,line):<br>
            print line<br>
        <br>
        def setCommand(self,line):<br>
            print line<br>
    <br>
        def setConsoleInfo(self,line):<br>
            print line<br>
    <br>
    tempOutput = 'D:/test_alg/map_to_clip.tif'<br>
    maskFN = 'D:/test_alg/mask.shp'<br>
    output = 'D:/test_alg/clipped_map.tif'<br>
    <br>
    cmds = ["gdalwarp",<br>
                "-dstnodata",<br>
                "-9999",<br>
                "-crop_to_cutline",<br>
                "-cutline",<br>
                maskFN,<br>
                tempOutput,<br>
                output]<br>
    <br>
    progress = MYProgress()<br>
    <br>
    GdalUtils.runGdal(cmds,progress)<br>
    <br>
    # Delete the file<br>
    os.remove(tempOutput)<br>
    <br>
    <br>
  </body>
</html>