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

Mattia Riccadonna Mattia_r at libero.it
Sun Jun 9 09:07:18 PDT 2013


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

Honestly I have not found the PATHENV in \etc\Init.bat. Is it a problem? 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.

>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 :)

Mattia




>----Messaggio originale----
>Da: hamish_b a yahoo.com
>Data: 09/06/2013 13.33
>A: <grass-user a lists.osgeo.org>, "Mattia Riccadonna"<Mattia_r a libero.it>
>Ogg: Re: [GRASS-user] problem add-ons and python (windows7)
>
>Mattia wrote:
>> I'm trying to solve my problem for a long time. I hope
>> someone can help me. 
>> I'm not expert but I really want to istall 2 add-on on grass
>> 6.4.3RC3 on my win7. The add-ons are r.basin and r.ipso. I think
>> there are problem with the python.exe and the PATHS. When I launch from
>> console r.ipso I receive this error:
>> 
>> C:\Program Files (x86)\GRASS GIS
>> 6.4.3RC3\extrabin\python.exe: can't open file 'r.ipso.py':
>> [Errno 2] No such file or directory
>
>the trouble with those two scripts are that they are written in python,
>and GRASS 6 does not handle python addon scripts as well as it does
>compiled C modules and UNIX shell scripts.
>
>the bad news is as you experience they don't work out of the box right
>now on Windows. The good news is that it is fixable. By moving and renaming
>some of the files I could get them to run locally on Windows XP.
>-- it's a solvable problem. I just ran r.basin.
>
>
>gory technical details:
>the basic one is Python.Make in GRASS 6's include/Make dir is not
>currently set up to create the .bat file wrappers needed to launch
>the scripts there. And/or the set PATHENV in \etc\Init.bat is not
>working properly. (it knows about .py but doesn't know to associate
>it with GRASS's python.exe)
>
>Secondly, there is a .bat wrapper called %ADDONS%/scripts/r.basin.py.bat
>which should be in %ADDONS%, and be named r.basin.bat. It contains a
>single line, but that is wrong too, it should be set up for a python
>script but it is created for a UNIX shell script. It should read like:
>
>@"%GRASS_PYTHON%" "%GRASS_ADDON_PATH%/r.basin" %*
>
>then the %ADDONS%\r.basin.py renamed to just r.basin, and finally
>the batch file run as "r.basin.bat".  Then it works.
>
>
>The better solution is to fix the .py association with python.exe, but
>care is needed to pick the right one, and not hijack that setting for
>the entire computer, since other software might be using another version
>of python.
>
>
>> I note that there are 2 python.exe. One in C:\Program Files
>> (x86)\GRASS GIS 6.4.3RC3\extrabin\ and one in C:\Program Files
>> (x86)\GRASS GIS 6.4.3 RC3\Pyton27\. I think that last one is the right
>> and I think that probably there is an error with the PATH. It is
>> possible?
>
>do you really have a python.exe in your ...\GRASS GIS 6.4.3 RC3\Python27\
>directory? For me it is only in ...\extrabin\ and in Python27\ there is
>only support files.
>
>As of last night's nightly build, 6.4.3svn explicitly expects to find
>its python.exe in the \extrabin\ dir.
>
> 
>> Can anyone drive me to the solution? I would need to know
>> where setting the different path beacuse I'm noob! I also see that
>> there is a folder in C: User\AppData\Roaming\GRASS6\addons... It is
>> normal that the add-ons are istalled ther instead of in GRASS GIS
>> 6.4.3RC3 directory?
>
>Yes, because the User can always write to their own AddData directly,
>but on a multi-user or managed (corporate) system the user may not have
>permission to change or add files to C:\Program Files.
>There is a %GRASS_ADDON_PATH% variable set which says where your personal
>scripts are stored. (can be set to multiple paths)
> 
>> When I launch r.basin I have an error that say aren't import
>> sys, os and matplotlib. Even though I have istall matplotlib for
>> Python27.
>
>I don't get that error, just the one from g.parser that it can't get
>the interface description (since it can't find the script). I'm surprised
>that sys and os can't be found, that indicates that your %PYTHONPATH% is
>broken since those two should always be built in. As for matplotlib I'm
>not sure if GRASS ships that, it might not & so need to be installed
>manually. (however you do that on Windows)
>
>
>again, python + grass6 + MS Windows is a work in progress :)
>fortunately only a few of the addons for grass6 are written in python,
>so it's not a very widespread problem, but is certainly a pretty basic
>need and something we want to support for the future.
>
>
>Hamish
>



More information about the grass-user mailing list