When you are running python scripts in QGIS via the QGIS own's python console or from a QGIS plugin (when using algorithms from the processing framework).

How to know or even change the version of GRASS that is being used?

This question came up while discussing this other question.


In the console: g.version.

In a plugin, the python expression:

import grass.script as gscript
ver = gscript.run_command('g.version')
  • sorry I missed your answer. I meant inside the QGIS python console... In QGIS it seems that the grass scripts are commonly used via the processing framework which uses this format to call algorithms from grass and other providers: processing.runalg(name_of_the_algorithm, ...). I updated the question's text to be more accurate. – eglatorre Feb 6 '17 at 10:00
  • is it possible to use this grass.script outside of GRASS console or from a plugin in QGIS directly? I think that is what this Processing framework achives somehow... – eglatorre Feb 6 '17 at 10:17
  • In the QGIS GRASS Plugin, you can open a console and run g.version. I don't know about the Processing Toolbox. – Micha Feb 6 '17 at 18:37
  • Thanks anyway @Micha! I am looking for how to find out from within QGIS... specially the processing framework – eglatorre Feb 7 '17 at 17:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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