* Moritz Lennert <mlenn...@club.worldonline.be> [2017-10-09 13:05:45 +0200]:

On 09/10/17 12:49, Nikos Alexandris wrote:
* Nikos Alexandris <n...@nikosalexandris.net> [2017-10-09 12:18:29 +0200]:

* Moritz Lennert <moritz.lenn...@ulb.ac.be> [2017-10-09 10:59:25 +0200]:

On 07/10/17 10:39, Nikos Alexandris wrote:
In a grassy script, how can I force verbosity, i.e. --v whenever a flag
-l is instructed? Which will lead to

env['GRASS_VERBOSE'] = '3'

?


i.some.module input=some_input -l

should be identical to

i.some.module input=some_input -l --v


The following is, of course, not working:

#%rules
#% requires_all: -l,--v
#%end


I don't think the -- flags are covered by the rules, so I think you
have to do this in the code, i.e. something like this:

if flags['l']:
        env['GRASS_VERBOSE'] = '3'

Merci Moritz,

I tested already (before asking)

env = os.environ.copy()
if list_only:
  env['GRASS_VERBOSE'] = '3'

but it does not work.

Yes, sorry, I just copied your line without thinking.


Aren't there other ways?

Thank you again, N

I guess simply

GRASS_VERBOSE=3
export GRASS_VERBOSE

It works!

Yes, but that's in a shell, not in Python, or ?

In Python, something like this should work IIRC:

import os
os.environ['GRASS_VERBOSE'] = '3'

But of course it works!  Don't know why I got stuck with env instead
os.environ.

Thanks, Nikos

Attachment: signature.asc
Description: PGP signature

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

Reply via email to