[GRASS-user] why is v.build.all (and many others) a windows batch file and not an executable?
Moritz Lennert
mlennert at club.worldonline.be
Wed May 4 03:01:54 PDT 2016
On 04/05/16 00:50, Bartolomei.Chris wrote:
> Hi Martin
> The problem I am having is that my bourne shell scripts (#!/bin/sh) cannot execute the bat files ... the scripts call the GRASS modules by name i.e.
> v.db.update map=stream_7 layer=3 column=block_col value="-1" --quiet
> In GRASS 6.4.4 (with msys) I could just run the scripts and everything ran fine.
> I've upgraded to 7.0.4 (from OSGEO4W and with msys) and now my scripts crash any time it tries to execute a GRASS module that is a bat wrapper saying it can't execute them.
> The error message is sh: v.db.update: command not found
> There is no v.db.update.exe ... only v.db.update.bat ... and, of course, v.db.update.py in the scripts directory.
> I have to code it as this now:
> python $PY_SCRIPTS/v.db.update.py map=stream_7 layer=3 column=block_col value="-1" --quiet
> (where PY_SCRIPTS is the path to the scripts, not the bat wrappers... i.e. c:/OSGEO4W64/apps/Grass/Grass-7.0.4/scripts)
>
> Note that v.db.update is just one of numerous examples ... I tried to attach the list but it bounced.
>
> I understand that some of this is written in C and some of this is written in python ... is it not possible to compile the python into an executable binary (.exe) and just have .exe's in bin?
> That would sure save some grief ...
As Helmut has tried to clarify, the issue is with msys, not with GRASS.
More fundamentally, the decision was made to make GRASS on Windows a
Windows experience, not a *nix emulation experience. This is one of the
reasons why scripts were translated to Python. Users are, therefore,
strongly encouraged to use Python as scripting language and not bash.
This allows to run your scripts in the standard cmd console and thus not
be hit by the incompatibilities between windows logic and *nix logic.
See [1] for a discussion on that topic. For the general discussion on
how to handle Python scripts and the installation of Python on the
machine, see [2] (be warned: it is one of the longest threads in the
grass-dev mailing list - spanning several months).
I understand that handling legacy scripts is an issue for many. But then
again a change in major version number does imply API changes... I don't
have a magical solution, here. The technically best solution is probably
to translate all your scripts to Python, but I am aware that this is not
always an option in the real world out there...
Moritz
[1] https://lists.osgeo.org/pipermail/grass-dev/2014-October/071263.html
[2] https://lists.osgeo.org/pipermail/grass-dev/2013-October/065896.html
More information about the grass-user
mailing list