3

I am writing a QGIS plugin using SAGA by Processing. Is is possible to test whether SAGA is installed and which version is on?

For GDAL, it's OK with:

processing.tools.raster.gdal.__version__

1 Answer 1

5

You might to want to look at some of the python code for SAGA algorithm providers, especially the module SagaUtils.py - that has a getSagaInstalledVersion() function, and a few functions for building the paths etc.

This is an example from the Python Console:-

>>> processing.algs.saga.SagaUtils.getSagaInstalledVersion()
'2.2.0'

Looking at the code, it's a wrapper around an external call to saga_cmd -v with retry logic

1
  • This is concise and works right !
    – Jean Hemmi
    Commented Dec 6, 2015 at 22:07

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.