On 23-03-16 15:24, Anna Petrášová wrote:
On Wed, Mar 23, 2016 at 10:01 AM, Luca Delucchi <lucadel...@gmail.com> wrote:
On 23 March 2016 at 14:31, Paulo van Breugel <p.vanbreu...@gmail.com> wrote:
Hi,

Hi,

I am using r.regression.multi in a python script (using grass.run_command())
to compute the variance inflation factor (VIF).  It runs in a loop,
regressing variables one by one to all the other variables. It sometimes
happen that the function fails with:

WARNING: Matrix is unsolvable
ERROR: Multiple regression failed

This causes my script to stop. However, I would like to capture this warning
/ error, and continue. Do you know how I can accomplish this?

did you try with try except ?
Yes, specifically:

from grass.exceptions import CalledModuleError

try:
     gscript.run_command(...)
except CalledModuleError:
    ...
Thanks Luca and Anna, I'll have a look at except and give it a try



Paulo

--
ciao
Luca

www.lucadelu.org
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-dev

Reply via email to