Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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.


share|improve this question
what version of gdal tools (see in the "raster" menu) are you using? – Giovanni Manghi Jan 18 '12 at 15:19
Giovanni, I am using GDAL v. 1.8.1 – kirk Jan 19 '12 at 12:40

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.

share|improve this answer
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 '12 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. – Giuseppe Sucameli Jan 21 '12 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 '12 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!

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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