[GRASS-user] execGRASS("r.diversity"): [Error 3] Cannot find path specified \\.grass7\\r.li

Sandra MacFadyen sandramf at live.co.za
Wed May 21 22:44:35 PDT 2014


Hi Glynn,

Thank you so much for your response.
I thought the easiest thing (since my python skills are limited) would be to
copy the contents of "%APPDATA%\GRASS7" to
"D:/Bands_processed1/.grass7/r.li", which I have done. I then created a
configuration file using r.li.setup in this directory as follows:

"conf_diversity_5.0"
SAMPLINGFRAME 0|0|1|1
SAMPLEAREA -1|-1|0.010526315789473684|0.009487666034155597
MOVINGWINDOW

Now when running the code, I get the following error:

> execGRASS("r.diversity",flags="overwrite",
parameters=list(input="s1993_tm5_rad.1", prefix="s1993_tm5_rad_divers.1",
alpha=0.5, size=5))
ERROR: Illegal areas disposition
ERROR: Illegal areas disposition
ERROR: Illegal areas disposition
ERROR: Illegal areas disposition
All works are terminated

The sample area didn't look right to me as my bounding area is, Top: 7389715
| Left: 272685 | Right: 506715 | Bottom: 7179985 in UTM Zone 36S. So, I
change the conf_diversity_5.0 file manually but I still get the same error
:( Any suggestions would be appreciated.

Thanks again
Sandra

-----Original Message-----
From: Glynn Clements [mailto:glynn at gclements.plus.com] 
Sent: 21 May 2014 07:39 PM
To: Sandra MacFadyen
Cc: grass-user at lists.osgeo.org; grass-dev at lists.osgeo.org
Subject: Re: [GRASS-user] execGRASS("r.diversity"): [Error 3] Cannot find
path specified \\.grass7\\r.li


[CC to grass-dev]

Sandra MacFadyen wrote:

>   File "C:/Program Files (x86)/GRASS GIS 
> 7.0.0beta2/scripts/r.diversity.py",
> line 116, in main
>     os.mkdir(rlidir)
> WindowsError: [Error 3] The system cannot find the path specified:
> 'D:/Bands_processed1\\.grass7\\r.li'

r.diversity.py is broken on Windows:

    home = os.path.expanduser('~')
    rlidir = os.path.join(home, '.grass7', 'r.li')

The script tries to create an r.li subdirectory, but fails because the
parent directory doesn't exist.

$HOME/.grass7 is correct for Unix, but on Windows it's %APPDATA%\GRASS7.
>From lib/init/grass.py:

    # configuration directory
    grass_env_file = None  # see check_shell()
    if sys.platform == 'win32':
        grass_config_dirname = "GRASS7"
        grass_config_dir = os.path.join(os.getenv('APPDATA'),
grass_config_dirname)
    else:
        grass_config_dirname = ".grass7"
        grass_config_dir = os.path.join(os.getenv('HOME'),
grass_config_dirname)

--
Glynn Clements <glynn at gclements.plus.com>



More information about the grass-user mailing list