[GRASS-dev] winGRASS: running several python modules in bat-files fails

hi,

just playing around with with running several GRASS modules in windows
bat-files.

example

test.bat with content:

REM ----------
@ECHO ON
g.region -p
v.in.region output=myreg2
v.db.addtable map=myreg2
v.db.addcolumn map=myreg2 columns="col1 inetger"
REM ----------

then copy the path to the bat-file into the winGRASS windows console, e.g.

C:\>D:\wd\test.bat

to run the bat file.

g.region, v.in.region and v.db.addtable are working, but the second python
module v.db.addcolumn fails.

I've tested it in several combinations, all binary modules are starting,
also the first python module, but never a second pthon module listed in the
bat-file.

any idea?

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/winGRASS-running-several-python-modules-in-bat-files-fails-tp5324173.html
Sent from the Grass - Dev mailing list archive at Nabble.com.

On Wed, Jun 14, 2017 at 8:39 AM, Helmut Kudrnovsky <hellik@web.de> wrote:

hi,

just playing around with with running several GRASS modules in windows
bat-files.

example

test.bat with content:

REM ----------
@ECHO ON
g.region -p
v.in.region output=myreg2
v.db.addtable map=myreg2
v.db.addcolumn map=myreg2 columns="col1 inetger"

typo in 'inetger'?

how does it fail?

REM ----------

then copy the path to the bat-file into the winGRASS windows console, e.g.

C:\>D:\wd\test.bat

to run the bat file.

g.region, v.in.region and v.db.addtable are working, but the second python
module v.db.addcolumn fails.

I've tested it in several combinations, all binary modules are starting,
also the first python module, but never a second pthon module listed in the
bat-file.

any idea?

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/winGRASS-running-several-python-modules-in-bat-files-fails-tp5324173.html
Sent from the Grass - Dev mailing list archive at Nabble.com.
_______________________________________________
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

v.db.addcolumn map=myreg2 columns="col1 inetger"

typo in 'inetger'?

oh :slight_smile:

how does it fail?

if you have several python modules listed in the bat file, only the first
one starts, the other aren't invoked.

the reason may be: in winGRASS the python scripts are invoked by bat-file
wrapper; if the first python module is started, it changes to the e.g.
v.db.addtable.bat, invokes the python script, but then it doesnt't come back
to test.bat, therefore the next python module in the list isn't started.

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/winGRASS-running-several-python-modules-in-bat-files-fails-tp5324173p5324181.html
Sent from the Grass - Dev mailing list archive at Nabble.com.

Helmut Kudrnovsky wrote

v.db.addcolumn map=myreg2 columns="col1 inetger"

typo in 'inetger'?

oh :slight_smile:

how does it fail?

if you have several python modules listed in the bat file, only the first
one starts, the other aren't invoked.

the reason may be: in winGRASS the python scripts are invoked by bat-file
wrapper; if the first python module is started, it changes to the e.g.
v.db.addtable.bat, invokes the python script, but then it doesnt't come
back to test.bat, therefore the next python module in the list isn't
started.

the solution is to call the python script wrapper:

REM ----------
@ECHO ON
g.region -p
v.in.region output=myreg3
call v.db.addtable map=myreg3
echo module done
call v.db.addcolumn map=myreg3 columns="col1 integer"
REM ----------

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/winGRASS-running-several-python-modules-in-bat-files-fails-tp5324173p5324185.html
Sent from the Grass - Dev mailing list archive at Nabble.com.

Helmut Kudrnovsky wrote

Helmut Kudrnovsky wrote

v.db.addcolumn map=myreg2 columns="col1 inetger"

typo in 'inetger'?

oh :slight_smile:

how does it fail?

if you have several python modules listed in the bat file, only the first
one starts, the other aren't invoked.

the reason may be: in winGRASS the python scripts are invoked by bat-file
wrapper; if the first python module is started, it changes to the e.g.
v.db.addtable.bat, invokes the python script, but then it doesnt't come
back to test.bat, therefore the next python module in the list isn't
started.

the solution is to call the python script wrapper:

REM ----------
@ECHO ON
g.region -p
v.in.region output=myreg3
call v.db.addtable map=myreg3
echo module done
call v.db.addcolumn map=myreg3 columns="col1 integer"
REM ----------

added in the wiki

https://grasswiki.osgeo.org/wiki/GRASS_and_bat-files_in_windows_console

-----
best regards
Helmut
--
View this message in context: http://osgeo-org.1560.x6.nabble.com/winGRASS-running-several-python-modules-in-bat-files-fails-tp5324173p5324190.html
Sent from the Grass - Dev mailing list archive at Nabble.com.