[GRASS-windows] Re: r.basin for windows [was Re:
WinGrass6.5.svn-installer with selected addons]
Glynn Clements
glynn at gclements.plus.com
Sat Oct 22 15:10:19 EDT 2011
Helmut Kudrnovsky wrote:
> I've tried all this above with a corresponding r.basin.bat, r.wf.bat and
> r.ipso.bat in C:\Program Files\GRASS 6.5.SVN\bin (the python-scripts
> r.basin.py, r.wf.py, r.ipso.py are in C:\Program Files\GRASS
> 6.5.SVN\scripts).
>
> but I'm not sure the content of r.basin.bat should
>
> @"%GRASS_PYTHON%" "%GISBASE%\scripts\r.basin.py" %*
> or
> @"%GRASS_PYTHON%" "%GISBASE%/scripts/r.basin.py" %*
Either should work, but the former is preferable. Both cmd.exe and
%GRASS_PYTHON% will be native Windows programs, so they'll prefer
backslashes to forward slashes in the event that it makes a
difference.
> >> is it possible to test which python interpreter is associated with the
> >> .py-extension?
> >
> >Create a Python script (with a .py extension) which prints useful
> >information (e.g. sys.prefix, sys.path, sys.version, etc), then
> >"execute" it via any native interface, e.g. system() in C, os.system()
> >or subprocess.Popen(..., shell=True) in Python, or "cmd /c ..." from a
> >shell script.
> >
> >The "sys" module is part of the main Python DLL, so it isn't affected
> >by PYTHONHOME and PYTHONPATH.
>
> my little python-testscript is:
> testpython.py
> #!/usr/bin/env python
> import sys
> print sys.prefix
> print
> print sys.path
> print
> print sys.version
>
> (1) in the wingrass-msys-shell within a grass-session:
> (2) in a windows command line outside any grass-session:
Neither of these cases matter. What matters is e.g.:
cmd /c testpython
Using a .bat file to force the use of %GRASS_PYTHON% is fine if you
can be sure that the .bat file will always be used.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the grass-windows
mailing list