I have a problem while using gdal_calc by a .bat file. Here is the code :

call "C:\OSGeo4w64\bin\o4w_env.bat" gdal_calc -A"D:\tuilage_script_1\tuilage\ndvi\4_810000_6370000_820000_6360000_ndvi.tif" --calc="A" --outfile="D:\tuilage_script_1\tuilage\ndvi\test_gdal_cal3.tif"

It first loads OSGEO environment, then it copies the input raster "A" in an output raster "outfile". The operation is done, but I get the following error messsage : "Python has stopped working", see picture enclosed


I already read this topic : GDAL_CALC works but I get a python error at the end of each process that prevents automation

But the solution doesn't fit with the aim of my batch file that must be automated to be run from an office basic script for more than 100 operations.

I am using 1.11.2 Gdal version with 2.8 Qgis Wien, 2.7 Python version on Windows-7.

  • I sometimes had problems with rasters because there wasn't an existing .tif file. Perhaps create a blank .tif file with the same name and location of the output file and run the script again?
    – Joseph
    May 5, 2015 at 14:19
  • Hi Joseph, thanks for you help! I have tried but now it doesn't even make the operation. I have" TypeError: unsupported operand type(s) for : *: 'NoneType and 'in'" an I also have the MsgBox "Python has stopped working". I even have this message when I call gdal_calc -help from Osfeo command line
    – poulpy
    May 5, 2015 at 14:43
  • Osgeo command line*
    – poulpy
    May 5, 2015 at 14:44
  • Hopefully others can advise on this issue as I have barely used gdal operations. Also, I'm not sure why you're receiving an operand error considering there's no multiplication symbol ( * ) in your above code.
    – Joseph
    May 5, 2015 at 14:54
  • Ok. Probably because I get get this first ouputfile from a r.mapcalc.
    – poulpy
    May 5, 2015 at 14:59

1 Answer 1


I'm not sure, but this might be caused by the version conflict of the linked C runtime dlls between gdal111.dll and python bindings. Dependency Walker shows that gdal111.dll is linked to msvcr100.dll, whereas _gdal.pyd is linked to msvcr90.dll. Opening a ticket in OSGeo4W bug tracker is a good idea.

  • Oh. Ok Thanks. By the way, I have also tryied on Qgis 2.4, Gdal 1.11.0 and it's the same. I am going to open this ticket. Thanks!
    – poulpy
    May 6, 2015 at 12:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.