[GRASS-dev] Re: Error when running a scrip in Windows-WinGRASS

Helena wrote:

Hi thereI have sent this message a couple of days ago... maybe it went
without any noticing.

more likely no one knew the answer :slight_smile:

Is it possible to have WinGRASS6.4 supporting only Python scrupts
instead of Batch?

don't know, let us know if you get it to work :slight_smile:

If I understand Glynn's comments correctly it won't work through the main
build system, but for personal add-on scripts that's not the end of the
world.

the important things is that both the script and python.exe can be found
in the path. You'll probably need to give your script a .py extension, and
make sure that Windows associates .py with Python and knows to run them
with python.exe. A web search will show a number of hits on how to do that,
and there's a number of mostly untested attempts at it deep within the
mswindows/ package installer scripts in the grass source code.

If the .py filename extension stuff fails, maybe you could write a custom
.bat file which launches "python your_script.py", something similar to what
is done for the UNIX shell scripts that ship with WinGrass 6.x.

So I would guess that it is not impossible to do it. As far as I know there
is nothing fundamental in the parser (at run time) which would restrict
running a module written in any language.

good luck,
Hamish

Hi

If I understand Glynn’s comments correctly it won’t work through the main
build system, but for personal add-on scripts that’s not the end of the
world.

That is exacly what I want. I have my winGRASS6.4 installation and I want to run/use some Python scripts. Just that…

the important things is that both the script and python.exe can be found
in the path. You’ll probably need to give your script a .py extension, and
make sure that Windows associates .py with Python and knows to run them
with python.exe. A web search will show a number of hits on how to do that,
and there’s a number of mostly untested attempts at it deep within the
mswindows/ package installer scripts in the grass source code.

I have browsed but I really didn’t find anyone attempting having a python script in winGRASS6.4.

If the .py filename extension stuff fails, maybe you could write a custom
.bat file which launches “python your_script.py”, something similar to what
is done for the UNIX shell scripts that ship with WinGrass 6.x.

YOu mean (e.g. my Script is called i.test.py
I should have a i.test.bat in bin folder and with the following?
@“%GRASS_SH%” -c ‘“%GISBASE%/scripts/i.test.py” %*’
??
How can I know if ther python is in the path?

THanks
helena

On Mon, Oct 11, 2010 at 1:29 PM, Helena Herrera
<helenaherrera1980@gmail.com> wrote:

Hi

If I understand Glynn's comments correctly it won't work through the main
build system, but for personal add-on scripts that's not the end of the
world.

That is exacly what I want. I have my winGRASS6.4 installation and I want to
run/use some Python scripts. Just that...

the important things is that both the script and python.exe can be found
in the path. You'll probably need to give your script a .py extension, and
make sure that Windows associates .py with Python and knows to run them
with python.exe. A web search will show a number of hits on how to do
that,
and there's a number of mostly untested attempts at it deep within the
mswindows/ package installer scripts in the grass source code.

I have browsed but I really didn't find anyone attempting having a python
script in winGRASS6.4.

If the .py filename extension stuff fails, maybe you could write a custom
.bat file which launches "python your_script.py", something similar to
what
is done for the UNIX shell scripts that ship with WinGrass 6.x.

YOu mean (e.g. my Script is called i.test.py
I should have a i.test.bat in bin folder and with the following?
@"%GRASS_SH%" -c '"%GISBASE%/scripts/i.test.py" %*'
??
How can I know if ther python is in the path?

Helena, did you check here?
http://grass.osgeo.org/wiki/GRASS_and_Python#MS-Windows

Markus