I would like to clip a DEM with an admin boundary using qgis, in order to calculate a measure of variation. However, when I use the Raster clipper tools and select mask, I get the error message: "An error has occured while executing Python code: ...".

It seems this has been noticed by others: see http://osgeo-org.1803224.n2.nabble.com/Re-qgis2google-and-clipper-plugins-td6604408.html

Does this imply that the tool is unavailable for use with Wroclaw 1.7.3?

All I am looking for is a measure of variation based on an admin boundary, and was planning to use the ruggedness index.

Is there a fix for the clipper tool I am unaware of, or any other simple way to calculate a measure of topological variation? It doesn't have to be ruggedness.


  • what version of gdal tools (see in the "raster" menu) are you using? Jan 18, 2012 at 15:19
  • Giovanni, I am using GDAL v. 1.8.1
    – kirk
    Jan 19, 2012 at 12:40

2 Answers 2


It's due to a python bug, fixed in python v2.5.3 and v2.6.1. Here's the ticket on QGis trac about that issue.

You can upgrade python (OSGeo4W is moving to python2.7) or remove the affected line (and also few lines below it) or even... use Linux.

  • Giuseppe, I installed 2.7.2 for OSX 1.7, but the clipper is still not working for me. Do I need to update any pathways or anything?
    – kirk
    Jan 19, 2012 at 12:41
  • @user5533 I think QGis is still using the old python. Please, run Qgis and from menu Plugins click on Python Console. In the console execute import sys; sys.version and report here. Jan 21, 2012 at 20:03
  • '2.7.1 (r271:86832, Jun 16 2011, 16:59:05) \n[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)]'
    – kirk
    Jan 22, 2012 at 20:37

Not a direct answer to your question, but a possible workaround: You could convert your vector mask to a raster, and do your processing using all raster data.

I would also suggest trying to run the command directly in GDAL rather than via QGIS. Sometimes I've had luck doing that!

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.