[GRASS-user] Problem with python script in osgeo4w grass 6.4.4 32bit

m roy royroge at outlook.com
Sun Nov 2 01:44:47 PST 2014


Dear Helmut,
thanks for your answer 

> Date: Sat, 1 Nov 2014 15:17:32 -0700
> From: hellik at web.de
> To: grass-user at lists.osgeo.org
> Subject: Re: [GRASS-user] Problem with python script in osgeo4w grass 6.4.4	32bit
> 
> m roy wrote
> > Dear all,
> > 
> > i made a python script for grass and it does not work in grass (version in
> > message subject).
> > The interface opens but a Windows error states that it is impossible to
> > open the file, the
> > file is hence not recognized as a valid command.
> > the script used to work with osgeo4w 6.4.3 32 bit, if copied in
> > "../etc/gui/scripts" directory. 
> 
> so far I know nothing about your script.

the script is a grass python script i made to automate some processing
and fondamentally uses r.mapcalc to perform map algebra e.g:

##
grass.mapcalc("$mapoutfile = abs($inraster)",mapoutfile=outraster+'_oname_'+kf.__name__,inraster=outraster+'_'+ofile.__name__)
##

> why is your script in "../etc/gui/scripts"? as it states this folder is for
> GUI scripts; AFAIR this folder may be not in %PATH%.
This beacause the script have an interface generated by grass parser,
and that is the only way I found to have it run in MS Windows (that worked in grass 6.4.3)
also the scrip flawlessly works in linux.

 
> have you any bat-wrapper for your python script in your %PATH%.
> for your python script r.your.script.py living in
> C:\OSGeo4W\apps\grass\grass-6.4.x\scripts the bat-wrapper-script
> r.your.script.bat should be in C:\OSGeo4W\apps\grass\grass-6.4.x\bin
> with following content
> 
> {
> @"%GRASS_PYTHON%" "%GISBASE%/scripts/r.your.script.py" %*
> }

I tried your advice, copied the script in

C:\OSGeo4W\apps\grass\grass-6.4.4\scripts

and made the bat file in

C:\OSGeo4W\apps\grass\grass-6.4.x\bin

but tring tu run it i get this error:

#### grass output:

Traceback (most recent call last):
  File "C:\OSGeo4W\apps\grass\grass-6.4.4\etc\wxpython\gui_c
ore\prompt.py", line 840, in OnItemSelected

self.cmdDesc = gtask.parse_interface(GetRealCmd(cmd))
  File "C:\OSGeo4W\apps\grass\grass-6.4.4\etc\python\grass\s
cript\task.py", line 474, in parse_interface

tree = etree.fromstring(get_interface_description(name))
  File "C:\OSGeo4W\apps\grass\grass-6.4.4\etc\python\grass\s
cript\task.py", line 452, in get_interface_description

"\n\nDetails: %(det)s") % { 'cmd' : cmd, 'det' :
decode(cmderr) }
grass.script.core
.
ScriptError

#### end


thanks, Roy.
















 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20141102/36d1f085/attachment.html>


More information about the grass-user mailing list