[GRASS-user] R: Re: problem add-ons and python (windows7)

Hamish hamish_b at yahoo.com
Tue Jun 11 03:39:31 PDT 2013


Hamish:
>> And/or the set PATHENV in \etc\Init.bat is not working properly.
>> (it knows about .py but doesn't know to associateit with GRASS's
>> python.exe)

Mattia wrote:
> Honestly I have not found the PATHENV in \etc\Init.bat. Is it a problem?

it should be there on line 69. I'm not sure if it means much without
assoc and ftype (see below).


> I tryed to know which one is the path that corresponds to python.exe
> but I wasn't able. The command try to open .py file always with pythom.exe
> from \extrabin.

On a copy of GRASS 6.4.3svn nightly build from today or yesterday,
running "echo $GRASS_PYTHON" from the Msys terminal, or 
"echo %GRASS_PYTHON%" from the C:\> dosbox window (both in the GRASS
section of the Start Menu) should show it.

wrt finding Matplotlib, the %PYTHONPATH% (or $PYTHONPATH) variable may be
interesting to look at as well. (apparently we don't ship it [yet])

you might also try this tip from the python docs, add this to C:\Program
Files\GRASS...\etc\env.bat:
  (http://docs.python.org/2/using/windows.html#executing-scripts)

assoc .py=Python.File
ftype Python.File="%GRASS_PYTHON%" "%1" %*

outside of the GRASS environment would probably be an error since
PYTHONPATH wasn't set system-wide.


you might also try changing the GRASS_PYTHON and PYTHONPATH to your
system installed Python.exe and support files, and so matplotlib too.
(change them together, keep them in sync)


>> Secondly, there is a .bat wrapper called %ADDONS%/scripts/r.basin.py.bat
>> which should be in %ADDONS%, and be named r.basin.bat.
>
> I wasn't able to find where to set %ADDONS% too. I saw only %
> GRASS_ADDON_PATH%. So confused :)

sorry, I was in a rush and abbreviated it. %GRASS_ADDON_PATH% is correct.


> In addition, I used g.extension to get add-ons. And with that command
> there aren't make files in any folder. Have I to re-download them
> manually? In case, where have I to put make files?

that part of my comment was mostly meant for the developers. Since most
Windows users don't have the full compiler and osgeo4w build environment
set up on Windows we (ie Martin) provides pre-built versions. For python
and shell scripts it isn't a big deal since there's noting to build, but
copying everything into the right spot and getting the extensions working
correctly can be a pain, as you've experienced.


You might also try to replicate the setup of e.g. d.rast3d.py and .bat
in C:\Program Files\GRASS...\etc\gui\scripts\, I tried that but no luck.

I know we're very close on python scripts + GRASS 6.4 + Windows, it's a
bit frustrating missing that last piece of the puzzle... after all the
g.extension.py script you used to download starts runs ok...


Hamish


More information about the grass-user mailing list